bookshelf/Bookshelf/Enderton/Set.tex

6363 lines
194 KiB
TeX

\documentclass{report}
\usepackage{graphicx}
\graphicspath{{./Set/images/}}
\input{../../preamble}
\makeleancommands{../..}
\newcommand{\pair}[1]{\left< #1 \right>}
\begin{document}
\header{Elements of Set Theory}{Herbert B. Enderton}
\tableofcontents
\begingroup
\renewcommand\thechapter{R}
\setcounter{chapter}{0}
\addtocounter{chapter}{-1}
\chapter{Reference}%
\hyperlabel{chap:reference}
\section{\defined{Axiom of Choice, First Form}}%
\hyperlabel{ref:axiom-of-choice-1}
For any relation $R$ there is a function $H \subseteq R$ with
$\dom{H} = \dom{R}$.
\begin{axiom}
\lean*{Init/Prelude}{Classical.choice}
\end{axiom}
\section{\defined{Axiom of Choice, Second Form}}%
\hyperlabel{ref:axiom-of-choice-2}
For any set $I$ and any function $H$ with domain $I$, if $H(i) \neq \emptyset$
for all $i \in I$, then $$\bigtimes_{i \in I} H(i) \neq \emptyset.$$
\begin{axiom}
\lean*{Init/Prelude}{Classical.choice}
\end{axiom}
\section{\defined{Cartesian Product}}%
\hyperlabel{ref:cartesian-product}
Let $I$ be a set and let $H$ be a \nameref{ref:function} whose domain includes $I$.
Then for each $i$ in $I$ we have the set $H(i)$.
We define the \textbf{cartesian product} of the $H(i)$'s as
$$\bigtimes_{i \in I} H(i) = \{f \mid
f \text{ is a function with domain } I \text{ and }
(\forall i \in I) f(i) \in H(i)\}.$$
\begin{definition}
\lean*{Mathlib/Data/Set/Prod}{Set.prod}
\end{definition}
\section{\defined{Compatible}}%
\hyperlabel{ref:compatible}
A \nameref{ref:function} $F$ is \textbf{compatible} with relation $R$ if and
only if for all $x$ and $y$ in $A$,
$$xRy \Rightarrow F(x)RF(y).$$
\begin{definition}
\lean*{Init/Core}{Quotient.lift}
\end{definition}
\section{\defined{Composition}}%
\hyperlabel{ref:composition}
The \textbf{composition} of sets $F$ and $G$ is
$$F \circ G = \{\pair{u, v} \mid \exists t(uGt \land tFv)\}.$$
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.comp}
\lean*{Mathlib/Data/Rel}{Rel.comp}
\end{definition}
\section{\defined{Connected}}%
\hyperlabel{ref:connected}
A binary relation $R$ on $A$ is \textbf{connected} if for distinct $x, y \in A$, either $xRy$ or $yRx$.
\begin{definition}
\lean*{Common/Algebra/Classes}{IsConnected}
\end{definition}
\section{\defined{Domain}}%
\hyperlabel{ref:domain}
The \textbf{domain} of set $R$, denoted $\dom{R}$, is given by
$$x \in \dom{R} \iff \exists y \pair{x, y} \in R.$$
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.dom}
\lean*{Mathlib/Data/Rel}{Rel.dom}
\end{definition}
\section{\defined{Empty Set Axiom}}%
\hyperlabel{ref:empty-set-axiom}
There is a set having no members:
$$\exists B, \forall x, x \not\in B.$$
\begin{axiom}
\lean*{Mathlib/Init/Set}{Set.emptyCollection}
\end{axiom}
\section{\defined{Equivalence Class}}%
\hyperlabel{ref:equivalence-class}
The set $[x]_R$ is defined by $$[x]_R = \{t \mid xRt\}.$$
If $R$ is an \nameref{ref:equivalence-relation} and $x \in fld R$, then $[x]_R$
is called the \textbf{equivalence class} of $x$ (\textbf{modulo $R$}).
If the relation $R$ is fixed by the context, we may write just $[x]$.
\begin{definition}
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.modEquiv}
\end{definition}
\section{\defined{Equivalence Relation}}%
\hyperlabel{ref:equivalence-relation}
Relation $R$ is an \textbf{equivalence relation} on set $A$ if and only if
$R$ is a binary \nameref{ref:relation} on $A$ that is \nameref{ref:reflexive}
on $A$, \nameref{ref:symmetric}, and \nameref{ref:transitive}.
\begin{definition}
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.isEquivalence}
\end{definition}
\section{\defined{Extensionality Axiom}}%
\hyperlabel{ref:extensionality-axiom}
If two sets have exactly the same members, then they are equal:
$$\forall A, \forall B,
\left[\forall x, (x \in A \iff x \in B) \Rightarrow A = B\right].$$
\begin{axiom}
\lean*{Mathlib/Init/Set}{Set.ext}
\end{axiom}
\section{\defined{Field}}%
\hyperlabel{ref:field}
Given \nameref{ref:relation} $R$, the \textbf{field} of $R$, denoted $\fld{R}$,
is given by $$\fld{R} = \dom{R} \cup \ran{R}.$$
\begin{definition}
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.fld}
\end{definition}
\section{\defined{Function}}%
\hyperlabel{ref:function}
A \textbf{function} is a relation $F$ such that for each $x$ in $\dom{F}$ there
is only one $y$ such that $xFy$.
In other words, $F$ is \textbf{single-valued}.
We say that $F$ is a function \textbf{from $A$ into $B$} or that $F$
\textbf{maps $A$ into $B$} (written $F \colon A \rightarrow B$) iff $F$ is a
function, $\dom{F} = A$, and $\ran{F} \subseteq B$.
If $\ran{F} = B$, then $F$ is a function from \textbf{$A$ onto $B$}.
A function $F$ is \textbf{one-to-one} iff for each $y \in \ran{F}$ there is only
one $x$ such that $xFy$.
One-to-one functions are sometimes called \textbf{injections}.
\begin{definition}
\statementpadding
\lean*{Mathlib/Init/Function}{Function.Injective}
\lean*{Mathlib/Init/Function}{Function.Surjective}
\lean*{Mathlib/Init/Function}{Function.Bijective}
\end{definition}
\section{\defined{Image}}%
\hyperlabel{ref:image}
Let $A$ and $F$ be arbitrary sets.
The \textbf{image of $A$ under $F$} is the set
\begin{align*}
\img{F}{A}
& = \ran{(F \restriction A)} \\
& = \{v \mid (\exists u \in A) uFv\}.
\end{align*}
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.image}
\lean*{Mathlib/Data/Rel}{Rel.image}
\end{definition}
\section{\defined{Inductive Set}}%
\hyperlabel{ref:inductive-set}
A set $A$ is said to be \textit{inductive} if and only if $\emptyset \in A$ and
it is "closed under \nameref{ref:successor}", i.e.
$$(\forall a \in A) a^+ \in A.$$
\begin{note}
Induction is baked into Lean's type system.
In particular, the $\emptyset$ and "closed under successor" properties are
analagous to base and recursive constructors of an inductive data type
respectively.
\end{note}
\begin{definition}
\statementpadding
\lean*{Prelude}{Nat}
\lean*{Mathlib/Init/Set}{Set.univ}
\end{definition}
\section{\defined{Infinity Axiom}}%
\hyperlabel{ref:infinity-axiom}
There exists an \nameref{ref:inductive-set}:
$$(\exists A)\left[ \emptyset \in A \land (\forall a \in A) a^+ \in A \right].$$
\begin{note}
Since the definition of natural numbers in Lean satisfies the properties
required by this axiom, there is no need to explicitly state the axiom
separately in Lean.
\end{note}
\begin{axiom}
\statementpadding
\lean*{Prelude}{Nat}
\lean*{Mathlib/Init/Set}{Set.univ}
\end{axiom}
\section{\defined{Inverse}}%
\hyperlabel{ref:inverse}
The \textbf{inverse} of a set $F$ is the set
$$F^{-1} = \{\pair{u, v} \mid vFu\}.$$
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.inv}
\lean{Mathlib/Data/Rel}{Rel.inv}
\end{definition}
\section{\defined{Irreflexive}}%
\hyperlabel{ref:irreflexive}
A binary relation $R$ on set $A$ is \textbf{irreflexive} if there is no $x \in A$ for which $xRx$.
\begin{definition}
\lean*{Mathlib/Init/Algebra/Classes}{IsIrrefl}
\end{definition}
\section{\defined{Linear Ordering}}
\hyperlabel{ref:linear-ordering}
Let $A$ be any set.
A \textbf{linear ordering} on $A$ (also called a \textbf{total ordering} on $A$)
is a binary relation $R$ on $A$ (i.e., $R \subseteq A \times A$) meeting the
following two conditions:
\begin{enumerate}[(a)]
\item $R$ is \nameref{ref:transitive}.
\item $R$ is \nameref{ref:trichotomous}.
\end{enumerate}
\begin{note}
This definition does not agree with how Lean defines a linear order.
\vspace{6pt}
Trichotomy is equivalent to asymmetry and connectivity and asymmetry is
equivalent to antisymmetry and irreflexivity.
Thus a linear order, as defined by Enderton, is a binary relation with the
following four properties:
\vspace{6pt}
\begin{enumerate}[(i)]
\item Irreflexivity
\item Antisymmetry
\item Connectivity (i.e. totality)
\item Transitivity
\end{enumerate}
\end{note}
\begin{definition}
\lean*{Mathlib/Init/Algebra/Classes}{IsStrictTotalOrder}
\end{definition}
\section{\defined{Natural Number}}%
\hyperlabel{ref:natural-number}
A \textbf{natural number} is a set that belongs to every inductive set.
The set of all natural numbers exists by virtue of \nameref{sub:theorem-4a}.
This set is denoted as $\omega$.
\begin{definition}
\lean*{Prelude}{Nat}
\end{definition}
\section{\defined{Ordered Pair}}%
\hyperlabel{ref:ordered-pair}
For any sets $u$ and $v$, the \textbf{ordered pair} $\pair{u, v}$ is
the set $\{\{u\}, \{u, v\}\}$.
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/OrderedPair}{OrderedPair}
\lean*{Prelude}{Prod}
\end{definition}
\section{\defined{Pair Set}}%
\hyperlabel{ref:pair-set}
For any sets $u$ and $v$, the \textbf{pair set $\{u, v\}$} is the set whose
only members are $u$ and $v$.
\begin{definition}
\statementpadding
\lean*{Mathlib/Init/Set}{Set.insert}
\lean*{Mathlib/Init/Set}{Set.singleton}
\end{definition}
\section{\defined{Pairing Axiom}}%
\hyperlabel{ref:pairing-axiom}
For any sets $u$ and $v$, there is a set having as members just $u$ and $v$:
$$\forall u, \forall v, \exists B, \forall x,
(x \in B \iff x = u \text{ or } x = v).$$
\begin{axiom}
\statementpadding
\lean*{Mathlib/Init/Set}{Set.insert}
\lean*{Mathlib/Init/Set}{Set.singleton}
\end{axiom}
\section{\defined{Partition}}%
\hyperlabel{ref:partition}
A \textbf{partition} $\Pi$ of a set $A$ is a set of nonempty subsets of $A$ that
is disjoint and exhaustive, i.e.
\begin{enumerate}[(a)]
\item no two different sets in $\Pi$ have any common elements, and
\item each element of $A$ is in some set in $\Pi$.
\end{enumerate}
\begin{definition}
\lean*{Mathlib/Data/Setoid/Partition}{Setoid.IsPartition}
\end{definition}
\section{\defined{Peano System}}%
\hyperlabel{ref:peano-system}
A \textbf{Peano system} is a triple $\langle N, S, e \rangle$ consisting of a
set $N$, a function $S \colon N \rightarrow N$, and a member $e \in N$ such
that the following three conditions are met:
\begin{enumerate}[(i)]
\item $e \not\in \ran{S}$.
\item $S$ is one-to-one.
\item Every subset $A$ of $N$ containing $e$ and closed under $S$ is $N$
itself.
\end{enumerate}
\begin{definition}
\lean*{Common/Set/Peano}{Peano.System}
\end{definition}
\section{\defined{Power Set}}%
\hyperlabel{ref:power-set}
For any set $a$, the \textbf{power set $\powerset{a}$} is the set whose members
are exactly the subsets of $a$.
\begin{definition}
\lean*{Mathlib/Init/Set}{Set.powerset}
\end{definition}
\section{\defined{Power Set Axiom}}%
\hyperlabel{ref:power-set-axiom}
For any set $a$, there is a set whose members are exactly the subsets of $a$:
$$\forall a, \exists B, \forall x, (x \in B \iff x \subseteq a).$$
\begin{axiom}
\lean*{Mathlib/Init/Set}{Set.powerset}
\end{axiom}
\section{\defined{Quotient Set}}%
\hyperlabel{ref:quotient-set}
If $R$ is an \nameref{ref:equivalence-relation} on set $A$, then we can define
the \textbf{quotient set} $$A / R = \{[x]_R \mid x \in A\}$$ whose members are
the equivalence classes.
The expression $A / R$ is read "$A$ modulo $R$.
\begin{definition}
\lean*{Init/Core}{Quotient}
\end{definition}
\section{\defined{Range}}%
\hyperlabel{ref:range}
The \textbf{range} of set $R$, denoted $\ran{R}$, is given by
$$x \in \ran{R} \iff \exists t \pair{t, x} \in R.$$
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.ran}
\lean*{Mathlib/Data/Rel}{Rel.codom}
\end{definition}
\section{\defined{Reflexive}}%
\hyperlabel{ref:reflexive}
A binary relation $R$ is \textbf{reflexive} on $A$ if and only if $xRx$ for all
$x \in A$.
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.isReflexive}
\lean*{Mathlib/Init/Algebra/Classes}{IsRefl}
\end{definition}
\section{\defined{Relation}}%
\hyperlabel{ref:relation}
A \textbf{relation} is a set of \nameref{ref:ordered-pair}s.
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation}
\lean*{Mathlib/Data/Rel}{Rel}
\end{definition}
\section{\defined{Restriction}}%
\hyperlabel{ref:restriction}
The \textbf{restriction} of a set $F$ to set $A$ is the set
$$F \restriction A = \{\pair{u, v} \mid uFv \land u \in A\}.$$
\begin{definition}
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.restriction}
\end{definition}
\section{\defined{Successor}}%
\label{ref:successor}
For any set $a$, its \textbf{successor} is defined by $$a^+ = a \cup \{a\}.$$
\begin{note}
The corresponding Lean reference refers to the `Nat.succ` constructor.
This is not represented internally as a union of sets, but serves the same
role.
\end{note}
\begin{definition}
\lean*{Prelude}{Nat.succ}
\end{definition}
\section{\defined{Subset Axioms}}%
\hyperlabel{ref:subset-axioms}
For each formula $\phi$ not containing $B$, the following is an axiom:
$$\forall t_1, \cdots \forall t_k, \forall c,
\exists B, \forall x, (x \in B \iff x \in c \land \phi).$$
\begin{axiom}
\lean*{Mathlib/Init/Set}{Set.Subset}
\end{axiom}
\section{\defined{Symmetric}}%
\hyperlabel{ref:symmetric}
A binary relation $R$ is \textbf{symmetric} if and only if whenever $xRy$ then
$yRx$.
\begin{definition}
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.isSymmetric}
\end{definition}
\section{\defined{Symmetric Difference}}%
\hyperlabel{ref:symmetric-difference}
The \textbf{symmetric difference} $A + B$ of sets $A$ and $B$ is the set
$(A - B) \cup (B - A)$.
\begin{definition}
\lean*{Mathlib/Data/Set/Basic}{symmDiff\_def}
\end{definition}
\section{\defined{Transitive}}%
\hyperlabel{ref:transitive}
A binary relation $R$ is \textbf{transitive} if and only if whenever $xRy$ and
$yRz$, then $xRz$.
\begin{definition}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}{Set.Relation.isTransitive}
\lean*{Mathlib/Init/Algebra/Classes}{IsTrans}
\end{definition}
\section{\defined{Transitive Set}}%
\hyperlabel{ref:transitive-set}
A set $A$ is said to be \textbf{transitive} if and only if every member of a
member of $A$ is a member of $A$ itself.
That is, $\bigcup A \subseteq A$.
\section{\defined{Trichotomous}}%
\hyperlabel{ref:trichotomous}
A binary relation $R$ on set $A$ is \textbf{trichotomous} if for any
$x, y \in A$, exactly one of the three alternatives
$$xRy, \quad x = y, \quad yRx$$
holds.
\begin{definition}
\lean*{Mathlib/Init/Algebra/Classes}{IsTrichotomous}
\end{definition}
\section{\defined{Union Axiom}}%
\hyperlabel{ref:union-axiom}
For any set $A$, there exists a set $B$ whose elements are exactly the members
of the members of $A$:
$$\forall A, \exists B, \forall x
\left[ x \in B \iff (\exists b \in A) x \in b \right]$$
\begin{axiom}
\lean*{Mathlib/Data/Set/Lattice}{Set.sUnion}
\end{axiom}
\section{\defined{Union Axiom, Preliminary Form}}%
\hyperlabel{ref:union-axiom-preliminary-form}
For any sets $a$ and $b$, there is a set whose members are those sets belonging
either to $a$ or to $b$ (or both):
$$\forall a, \forall b, \exists B, \forall x,
(x \in B \iff x \in a \text{ or } x \in b).$$
\begin{axiom}
\lean*{Mathlib/Init/Set}{Set.union}
\end{axiom}
\endgroup
\chapter{Introduction}%
\hyperlabel{chap:introduction}
\section{Exercises 1}%
\hyperlabel{sec:exercises-1}
\subsection{\verified{Exercise 1.1}}%
\hyperlabel{sub:exercise-1.1}
Which of the following become true when "$\in$" is inserted in place of the
blank?
Which become true when "$\subseteq$" is inserted?
\subsubsection{\verified{Exercise 1.1a}}%
\hyperlabel{ssub:exercise-1.1a}
$\{\emptyset\} \_\_\_\_ \{\emptyset, \{\emptyset\}\}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_1a}
Because the \textit{object} $\{\emptyset\}$ is a member of the right-hand set,
the statement is \textbf{true} in the case of "$\in$".
Because the \textit{members} of $\{\emptyset\}$ are all members of the
right-hand set, the statement is also \textbf{true} in the case of
"$\subseteq$".
\end{proof}
\subsubsection{\verified{Exercise 1.1b}}%
\hyperlabel{ssub:exercise-1.11b}
$\{\emptyset\} \_\_\_\_ \{\emptyset, \{\{\emptyset\}\}\}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_1b}
Because the \textit{object} $\{\emptyset\}$ is not a member of the right-hand
set, the statement is \textbf{false} in the case of "$\in$".
Because the \textit{members} of $\{\emptyset\}$ are all members of the
right-hand set, the statement is \textbf{true} in the case of "$\subseteq$".
\end{proof}
\subsubsection{\verified{Exercise 1.1c}}%
\hyperlabel{ssub:exercise-1.1c}
$\{\{\emptyset\}\} \_\_\_\_ \{\emptyset, \{\emptyset\}\}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_1c}
Because the \textit{object} $\{\{\emptyset\}\}$ is not a member of the
right-hand set, the statement is \textbf{false} in the case of "$\in$".
Because the \textit{members} of $\{\{\emptyset\}\}$ are all members of the
right-hand set, the statement is \textbf{true} in the case of "$\subseteq$".
\end{proof}
\subsubsection{\verified{Exercise 1.1d}}%
\hyperlabel{ssub:exercise-1.1d}
$\{\{\emptyset\}\} \_\_\_\_ \{\emptyset, \{\{\emptyset\}\}\}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_1d}
Because the \textit{object} $\{\{\emptyset\}\}$ is a member of the right-hand
set, the statement is \textbf{true} in the case of "$\in$".
Because the \textit{members} of $\{\{\emptyset\}\}$ are not all members of the
right-hand set, the statement is \textbf{false} in the case of
"$\subseteq$".
\end{proof}
\subsubsection{\verified{Exercise 1.1e}}%
\hyperlabel{ssub:exercise-1.1e}
$\{\{\emptyset\}\} \_\_ \{\emptyset, \{\emptyset, \{\emptyset\}\}\}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_1e}
Because the \textit{object} $\{\{\emptyset\}\}$ is not a member of the
right-hand set, the statement is \textbf{false} in the case of "$\in$".
Because the \textit{members} of $\{\{\emptyset\}\}$ are not all members of the
right-hand set, the statement is \textbf{false} in the case of
"$\subseteq$".
\end{proof}
\subsection{\verified{Exercise 1.2}}%
\hyperlabel{sub:exercise-1.2}
Show that no two of the three sets $\emptyset$, $\{\emptyset\}$, and
$\{\{\emptyset\}\}$ are equal to each other.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_2}
By the \nameref{ref:extensionality-axiom}, $\emptyset$ is only equal to
$\emptyset$.
This immediately shows it is not equal to the other two.
Now consider object $\emptyset$.
This object is a member of $\{\emptyset\}$ but is not a member of
$\{\{\emptyset\}\}$.
Again, by the \nameref{ref:extensionality-axiom}, these two sets must be
different.
\end{proof}
\subsection{\verified{Exercise 1.3}}%
\hyperlabel{sub:exercise-1.3}
Show that if $B \subseteq C$, then $\powerset{B} \subseteq \powerset{C}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_3}
Let $x \in \powerset{B}$.
By definition of the \nameref{ref:power-set}, $x$ is a subset of $B$.
By hypothesis, $B \subseteq C$.
Then $x \subseteq C$.
Again by definition of the \nameref{ref:power-set}, it follows
$x \in \powerset{C}$.
\end{proof}
\subsection{\verified{Exercise 1.4}}%
\hyperlabel{sub:exercise-1.4}
Assume that $x$ and $y$ are members of a set $B$.
Show that $\{\{x\}, \{x, y\}\} \in \powerset{\powerset{B}}.$
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_1}
{Enderton.Set.Chapter\_1.exercise\_1\_4}
Let $x$ and $y$ be members of set $B$.
Then $\{x\}$ and $\{x, y\}$ are subsets of $B$.
By definition of the \nameref{ref:power-set}, $\{x\}$ and $\{x, y\}$ are
members of $\powerset{B}$.
Then $\{\{x\}, \{x, y\}\}$ is a subset of $\powerset{B}$.
By definition of the \nameref{ref:power-set}, $\{\{x\}, \{x, y\}\}$ is a
member of $\powerset{\powerset{B}}$.
\end{proof}
\subsection{\unverified{Exercise 1.5}}%
\hyperlabel{sub:exercise-1.5}
Define the rank of a set $c$ to be the least $\alpha$ such that
$c \subseteq V_\alpha$.
Compute the rank of $\{\{\emptyset\}\}$.
Compute the rank of
$\{\emptyset, \{\emptyset\}, \{\emptyset, \{\emptyset\}\}\}$.
\begin{proof}
We first compute the values of $V_n$ for $0 \leq n \leq 3$ under the
assumption the set of atoms $A$ at the bottom of the hierarchy is empty.
\begin{align*}
V_0 & = \emptyset \\
V_1 & = V_0 \cup \powerset{V_0} \\
& = \emptyset \cup \{\emptyset\} \\
& = \{\emptyset\} \\
V_2 & = V_1 \cup \powerset{V_1} \\
& = \{\emptyset\} \cup \powerset{\{\emptyset\}} \\
& = \{\emptyset\} \cup \{\emptyset, \{\emptyset\}\} \\
& = \{\emptyset, \{\emptyset\}\} \\
V_3 & = V_2 \cup \powerset{V_2} \\
& = \{\emptyset, \{\emptyset\}\} \cup
\powerset{\{\emptyset, \{\emptyset\}\}} \\
& = \{\emptyset, \{\emptyset\}\} \cup
\{\emptyset,
\{\emptyset\},
\{\{\emptyset\}\},
\{\emptyset, \{\emptyset\}\}\} \\
& = \{\emptyset,
\{\emptyset\},
\{\{\emptyset\}\},
\{\emptyset, \{\emptyset\}\}\}
\end{align*}
It then immediately follows $\{\{\emptyset\}\}$ has rank $2$ and
$\{\emptyset, \{\emptyset\}, \{\emptyset, \{\emptyset\}\}\}$ has rank $3$.
\end{proof}
\subsection{\unverified{Exercise 1.6}}%
\hyperlabel{sub:exercise-1.6}
We have stated that $V_{\alpha + 1} = A \cup \powerset{V_\alpha}$.
Prove this at least for $\alpha < 3$.
\begin{proof}
Let $A$ be the set of atoms in our set hierarchy.
Let $P(n)$ be the predicate, "$V_{n + 1} = A \cup \powerset{V_n}$."
We prove $P(n)$ holds true for all natural numbers $n \geq 1$ via induction.
\paragraph{Base Case}%
Let $n = 1$.
By definition, $V_1 = V_0 \cup \powerset{V_0}$.
By definition, $V_0 = A$.
Therefore $V_1 = A \cup \powerset{V_0}$.
This proves $P(1)$ holds true.
\paragraph{Induction Step}%
Suppose $P(n)$ holds true for some $n \geq 1$.
Consider $V_{n+1}$.
By definition, $V_{n+1} = V_n \cup \powerset{V_n}$.
Therefore, by the induction hypothesis,
\begin{align}
V_{n+1}
& = V_n \cup \powerset{V_n}
\nonumber \\
& = (A \cup \powerset{V_{n-1}}) \cup \powerset{V_n}
\nonumber \\
& = A \cup (\powerset{V_{n-1}} \cup \powerset{V_n})
\hyperlabel{sub:exercise-1.6-eq1}
\end{align}
But $V_{n-1}$ is a subset of $V_n$.
\nameref{sub:exercise-1.3} then implies
$\powerset{V_{n-1}} \subseteq \powerset{V_n}$.
This means \eqref{sub:exercise-1.6-eq1} can be simplified to
$$V_{n+1} = A \cup \powerset{V_n},$$
proving $P(n+1)$ holds true.
\paragraph{Conclusion}%
By mathematical induction, it follows for all $n \geq 1$, $P(n)$ is true.
\end{proof}
\subsection{\unverified{Exercise 1.7}}%
\hyperlabel{sub:exercise-1.7}
List all the members of $V_3$.
List all the members of $V_4$.
(It is to be assumed here that there are no atoms.)
\begin{proof}
As seen in the proof of \nameref{sub:exercise-1.5},
$$V_3 = \{
\emptyset,
\{\emptyset\},
\{\{\emptyset\}\},
\{\emptyset, \{\emptyset\}\}
\}.$$
By \nameref{sub:exercise-1.6}, $V_4 = \powerset{V_3}$ (since it is assumed
there are no atoms).
Thus
\begin{align*}
& V_4 = \{ \\
& \qquad \emptyset, \\
& \qquad \{\emptyset\}, \\
& \qquad \{\{\emptyset\}\}, \\
& \qquad \{\{\{\emptyset\}\}\}, \\
& \qquad \{\{\emptyset, \{\emptyset\}\}\}, \\
& \qquad \{\emptyset, \{\emptyset\}\}, \\
& \qquad \{\emptyset, \{\{\emptyset\}\}\}, \\
& \qquad \{\emptyset, \{\emptyset, \{\emptyset\}\}\}, \\
& \qquad \{\{\emptyset\}, \{\{\emptyset\}\}\}, \\
& \qquad \{\{\emptyset\}, \{\emptyset, \{\emptyset\}\}\}, \\
& \qquad \{\{\{\emptyset\}\}, \{\emptyset, \{\emptyset\}\}\}, \\
& \qquad \{\emptyset, \{\emptyset\}, \{\{\emptyset\}\}\}, \\
& \qquad \{\emptyset, \{\emptyset\}, \{\emptyset, \{\emptyset\}\}\}, \\
& \qquad \{\emptyset, \{\{\emptyset\}\}, \{\emptyset, \{\emptyset\}\}\} \\
& \qquad \{\{\emptyset\}, \{\{\emptyset\}\}, \{\emptyset, \{\emptyset\}\}\}, \\
& \qquad \{\emptyset, \{\emptyset\}, \{\{\emptyset\}\}, \{\emptyset, \{\emptyset\}\}\} \\
& \}.
\end{align*}
\end{proof}
\chapter{Axioms and Operations}%
\hyperlabel{chap:axioms-operations}
\section{Axioms}%
\hyperlabel{sec:axioms}
\subsection{\unverified{Theorem 2A}}%
\hyperlabel{sub:theorem-2a}
\begin{theorem}[2A]
There is no set to which every set belongs.
\begin{note}
This was revisited after reading Enderton's proof prior.
\end{note}
\end{theorem}
\begin{proof}
Let $A$ be an arbitrary set.
Define $B = \{ x \in A \mid x \not\in x \}$.
By the \nameref{ref:subset-axioms}, $B$ is a set.
Then $$B \in B \iff B \in A \land B \not\in B.$$
If $B \in A$, then $B \in B \iff B \not\in B$, a contradiction.
Thus $B \not\in A$.
Since this process holds for any set $A$, there must exist no set to which
every set belongs.
\end{proof}
\subsection{\unverified{Theorem 2B}}%
\hyperlabel{sub:theorem-2b}
\begin{theorem}[2B]
For any nonempty set $A$, there exists a unique set $B$ such that for any
$x$, $$x \in B \iff x \text{ belongs to every member of } A.$$
\end{theorem}
\begin{proof}
Suppose $A$ is a nonempty set.
This ensures the statement we are trying to prove does not vacuously hold for
all sets $x$ (which would yield a contradiction due to
\nameref{sub:theorem-2b}).
By the \nameref{ref:union-axiom}, $\bigcup A$ is a set.
Define $$B = \{ x \in \bigcup A \mid (\forall b \in A), x \in b \}.$$
By the \nameref{ref:subset-axioms}, $B$ is indeed a set.
By construction,
$$\forall x, x \in B \iff x \text{ belongs to every member of } A.$$
By the \nameref{ref:extensionality-axiom}, $B$ is unique.
\end{proof}
\section{Algebra of Sets}%
\hyperlabel{sec:algebra-sets}
\subsection{\verified{Commutative Laws}}%
\hyperlabel{sub:commutative-laws}
For any sets $A$ and $B$,
\begin{align*}
A \cup B = B \cup A \\
A \cap B = B \cap A
\end{align*}
\begin{proof}
\statementpadding
\lean*{Mathlib/Data/Set/Basic}{Set.union\_comm}
\lean{Mathlib/Data/Set/Basic}{Set.inter\_comm}
\noindent Let $A$ and $B$ be sets.
We prove that
\begin{enumerate}[(i)]
\item $A \cup B = B \cup A$
\item $A \cap B = B \cap A$.
\end{enumerate}
\paragraph{(i)}%
By the definition of the union of sets,
\begin{align*}
A \cup B
& = \{ x \mid x \in A \lor x \in B \} \\
& = \{ x \mid x \in B \lor x \in A \} \\
& = B \cup A.
\end{align*}
\paragraph{(ii)}%
By the definition of the intersection of sets,
\begin{align*}
A \cap B
& = \{ x \mid x \in A \land x \in B \} \\
& = \{ x \mid x \in B \land x \in A \} \\
& = B \land A.
\end{align*}
\end{proof}
\subsection{\verified{Associative Laws}}%
\hyperlabel{sub:associative-laws}
For any sets $A$, $B$ and $C$,
\begin{align*}
A \cup (B \cup C) & = (A \cup B) \cup C \\
A \cap (B \cap C) & = (A \cap B) \cap C
\end{align*}
\begin{proof}
\statementpadding
\lean*{Mathlib/Data/Set/Basic}{Set.union\_assoc}
\lean{Mathlib/Data/Set/Basic}{Set.inter\_assoc}
\noindent Let $A$, $B$, and $C$ be sets.
We prove that
\begin{enumerate}[(i)]
\item $A \cup (B \cup C) = (A \cup B) \cup C$
\item $A \cap (B \cap C) = (A \cap B) \cap C$
\end{enumerate}
\paragraph{(i)}%
By the definition of the union of sets,
\begin{align*}
A \cup (B \cup C)
& = \{ x \mid x \in A \lor x \in (B \cup C) \} \\
& = \{ x \mid x \in A \lor x \in \{ y \mid y \in B \lor C \}\} \\
& = \{ x \mid x \in A \lor (x \in B \lor x \in C) \} \\
& = \{ x \mid (x \in A \lor x \in B) \lor x \in C \} \\
& = \{ x \mid x \in \{ y \mid y \in A \lor y \in B \} \lor
x \in C \} \\
& = \{ x \mid x \in (A \cup B) \lor x \in C \} \\
& = (A \cup B) \cup C.
\end{align*}
\paragraph{(ii)}%
By the definition of the intersection of sets,
\begin{align*}
A \cap (B \cap C)
& = \{ x \mid x \in A \land x \in (B \cap C) \} \\
& = \{ x \mid x \in A \land
x \in \{ y \mid y \in B \land y \in C \}\} \\
& = \{ x \mid x \in A \land (x \in B \land x \in C) \} \\
& = \{ x \mid (x \in A \land x \in B) \land x \in C \} \\
& = \{ x \mid x \in \{ y \mid y \in A \land y \in B \} \land
x \in C \} \\
& = \{ x \mid x \in (A \cap B) \land x \in C \} \\
& = (A \cap B) \cap C.
\end{align*}
\end{proof}
\subsection{\verified{Distributive Laws}}%
\hyperlabel{sub:distributive-laws}
For any sets $A$, $B$, and $C$,
\begin{align*}
A \cap (B \cup C) & = (A \cap B) \cup (A \cap C) \\
A \cup (B \cap C) & = (A \cup B) \cap (A \cup C)
\end{align*}
\begin{proof}
\statementpadding
\lean*{Mathlib/Data/Set/Basic}{Set.inter\_distrib\_left}
\lean{Mathlib/Data/Set/Basic}{Set.union\_distrib\_left}
\noindent Let $A$, $B$, and $C$ be sets.
We prove that
\begin{enumerate}[(i)]
\item $A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$
\item $A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$
\end{enumerate}
\paragraph{(i)}%
By the definition of the union and intersection of sets,
\begin{align*}
A \cap (B \cup C)
& = \{ x \mid x \in A \land x \in B \cup C \} \\
& = \{ x \mid x \in A \land
x \in \{ y \mid y \in B \lor y \in C \}\} \\
& = \{ x \mid x \in A \land (x \in B \lor x \in C) \} \\
& = \{ x \mid (x \in A \land x \in B) \lor
(x \in A \land x \in C) \} \\
& = \{ x \mid x \in A \cap B \lor x \in A \cap C \} \\
& = (A \cap B) \cup (A \cap C).
\end{align*}
\paragraph{(ii)}%
By the definition of the union and intersection of sets,
\begin{align*}
A \cup (B \cap C)
& = \{ x \mid x \in A \lor x \in B \cap C \} \\
& = \{ x \mid x \in A \lor
x \in \{ y \mid y \in B \land y \in C \}\} \\
& = \{ x \mid x \in A \lor (x \in B \land x \in C) \} \\
& = \{ x \mid (x \in A \lor x \in B) \land
(x \in A \lor x \in C) \} \\
& = \{ x \mid x \in A \cup B \land x \in A \cup C \} \\
& = (A \cup B) \cap (A \cup C).
\end{align*}
\end{proof}
\subsection{\verified{De Morgan's Laws}}%
\hyperlabel{sub:de-morgans-laws}
For any sets $A$, $B$, and $C$,
\begin{align*}
C - (A \cup B) & = (C - A) \cap (C - B) \\
C - (A \cap B) & = (C - A) \cup (C - B)
\end{align*}
\begin{proof}
\statementpadding
\lean*{Mathlib/Data/Set/Basic}{Set.diff\_inter\_diff}
\lean{Mathlib/Data/Set/Basic}{Set.diff\_inter}
\noindent Let $A$, $B$, and $C$ be sets.
We prove that
\begin{enumerate}[(i)]
\item $C - (A \cup B) = (C - A) \cap (C - B)$
\item $C - (A \cap B) = (C - A) \cup (C - B)$
\end{enumerate}
\paragraph{(i)}%
By definition of the union, intersection, and relative complements of sets,
\begin{align*}
C - (A \cup B)
& = \{ x \mid x \in C \land x \not\in A \cup B \} \\
& = \{ x \mid x \in C \land
x \not\in \{ y \mid y \in A \lor y \in B \}\} \\
& = \{ x \mid x \in C \land \neg(x \in A \lor x \in B) \} \\
& = \{ x \mid x \in C \land (x \not\in A \land x \not\in B) \} \\
& = \{ x \mid (x \in C \land x \not\in A) \land
(x \in C \land x \not\in B) \} \\
& = \{ x \mid x \in (C - A) \land x \in (C - B) \} \\
& = (C - A) \cap (C - B).
\end{align*}
\paragraph{(ii)}%
By definition of the union, intersection, and relative complements of sets,
\begin{align*}
C - (A \cap B)
& = \{ x \mid x \in C \land x \not\in A \cap B \} \\
& = \{ x \mid x \in C \land
x \not\in \{ y \mid y \in A \land y \in B \}\} \\
& = \{ x \mid x \in C \land \neg(x \in A \land x \in B) \} \\
& = \{ x \mid x \in C \land (x \not\in A \lor x \not\in B) \} \\
& = \{ x \mid (x \in C \land x \not\in A) \lor
(x \in C \land x \not\in B) \} \\
& = \{ x \mid x \in (C - A) \lor x \in (C - B) \} \\
& = (C - A) \cup (C - B).
\end{align*}
\end{proof}
\subsection{\verified{%
Identities Involving \texorpdfstring{$\emptyset$}{the Empty Set}}}%
\hyperlabel{sub:identitives-involving-empty-set}
For any set $A$,
\begin{align*}
A \cup \emptyset & = A \\
A \cap \emptyset & = \emptyset \\
A \cap (C - A) & = \emptyset
\end{align*}
\begin{proof}
\statementpadding
\lean*{Mathlib/Data/Set/Basic}{Set.union\_empty}
\lean*{Mathlib/Data/Set/Basic}{Set.inter\_empty}
\lean{Mathlib/Data/Set/Basic}{Set.inter\_diff\_self}
\noindent Let $A$ be an arbitrary set.
We prove that
\begin{enumerate}[(i)]
\item $A \cup \emptyset = A$
\item $A \cap \emptyset = \emptyset$
\item $A \cap (C - A) = \emptyset$
\end{enumerate}
\paragraph{(i)}%
By definition of the emptyset and union of sets,
\begin{align*}
A \cup \emptyset
& = \{ x \mid x \in A \lor x \in \emptyset \} \\
& = \{ x \mid x \in A \lor F \} \\
& = \{ x \mid x \in A \} \\
& = A.
\end{align*}
\paragraph{(ii)}%
By definition of the emptyset and intersection of sets,
\begin{align*}
A \cap \emptyset
& = \{ x \mid x \in A \land x \in \emptyset \} \\
& = \{ x \mid x \in A \land F \} \\
& = \{ x \mid F \} \\
& = \{ x \mid x \neq x \} \\
& = \emptyset.
\end{align*}
\paragraph{(iii)}%
By definition of the emptyset, and the intersection and relative complement
of sets,
\begin{align*}
A \cap (C - A)
& = \{ x \mid x \in A \land x \in C - A \} \\
& = \{ x \mid x \in A \land
x \in \{ y \mid y \in C \land y \not\in A \}\} \\
& = \{ x \mid x \in A \land (x \in C \land x \not\in A) \} \\
& = \{ x \mid x \in C \land F \} \\
& = \{ x \mid F \} \\
& = \{ x \mid x \neq x \} \\
& = \emptyset.
\end{align*}
\end{proof}
\subsection{\verified{Monotonicity}}%
\hyperlabel{sub:monotonicity}
For any sets $A$, $B$, and $C$,
\begin{align*}
A \subseteq B & \Rightarrow A \cup C \subseteq B \cup C \\
A \subseteq B & \Rightarrow A \cap C \subseteq B \cap C \\
A \subseteq B & \Rightarrow \bigcup A \subseteq \bigcup B
\end{align*}
\begin{proof}
\statementpadding
\lean*{Mathlib/Data/Set/Basic}{Set.union\_subset\_union\_left}
\lean*{Mathlib/Data/Set/Basic}{Set.inter\_subset\_inter\_left}
\lean{Mathlib/Data/Set/Lattice}{Set.sUnion\_mono}
\noindent Let $A$, $B$, and $C$ be arbitrary sets.
We prove that
\begin{enumerate}[(i)]
\item $A \subseteq B \Rightarrow A \cup C \subseteq B \cup C$
\item $A \subseteq B \Rightarrow A \cap C \subseteq B \cap C$
\item $A \subseteq B \Rightarrow \bigcup A \subseteq \bigcup B$
\end{enumerate}
\paragraph{(i)}%
Suppose $A \subseteq B$.
Let $x \in A \cup C$.
There are two cases to consider.
\subparagraph{Case 1}%
Suppose $x \in A$.
Then, by definition of the subset, $x \in B$.
Therefore $x \in B \cup C$.
\subparagraph{Case 2}%
Suppose $x \in C$.
Then $x$ is trivially a member of $B \cup C$.
\subparagraph{Conclusion}%
Since these cases are exhaustive and both imply $x \in B \cup C$, it
follows $A \cup C \subseteq B \cup C$.
\paragraph{(ii)}%
Suppose $A \subseteq B$.
Let $x \in A \cap C$.
Then, by definition of the intersection of sets, $x \in A$ and $x \in C$.
By definition of the subset, $x \in A$ implies $x \in B$.
Therefore $x \in B$ and $x \in C$.
That is, $x \in B \cap C$.
Since this holds for arbitrary $x \in A \cap C$, it follows
$A \cap C \subseteq B \cap C$.
\paragraph{(iii)}%
Suppose $A \subseteq B$.
Let $x \in \bigcup A$.
Then, by definition of the union of sets, there exists some $b \in A$ such
that $x \in b$.
By definition of the subset, $b \in B$ as well.
Another application of the definition of the union of sets immediately
implies that $x$ is a member of $\bigcup B$.
\end{proof}
\subsection{\verified{Anti-monotonicity}}%
\hyperlabel{sub:anti-monotonicity}
For any sets $A$, $B$, and $C$,
\begin{align*}
A \subseteq B & \Rightarrow C - B \subseteq C - A \\
\emptyset \neq A \subseteq B & \Rightarrow \bigcap B \subseteq \bigcap A.
\end{align*}
\begin{proof}
\statementpadding
\lean*{Mathlib/Data/Set/Basic}{Set.diff\_subset\_diff\_right}
\lean{Mathlib/Data/Set/Lattice}{Set.sInter\_subset\_sInter}
\noindent Let $A$, $B$, and $C$ be arbitrary sets.
We prove that
\begin{enumerate}[(i)]
\item $A \subseteq B \Rightarrow C - B \subseteq C - A$
\item $\emptyset \neq A \subseteq B \Rightarrow
\bigcap B \subseteq \bigcap A$
\end{enumerate}
\paragraph{(i)}%
Suppose $A \subseteq B$.
Let $x \in C - B$.
By definition of the relative complement, $x \in C$ and $x \not\in B$.
Then $x$ cannot be a member of $A$, since otherwise this would contradict
our subset hypothesis.
That is, $x \in C$ and $x \not\in A$.
Therefore $x \in C - A$.
Since this holds for arbitrary $x \in C - B$, it follows that
$C - B \subseteq C - A$.
\paragraph{(ii)}%
Suppose $A \neq \emptyset$ and $A \subseteq B$.
Then $B \neq \emptyset$.
Let $x \in \bigcap B$.
By definition of the intersection of sets, for all $b \in B$, $x \in b$.
But then, by definition of the subset, for all $a \in A$, $x \in a$.
Therefore $x \in \bigcap A$.
Since this holds for arbitrary $x \in \bigcap B$, it follows that
$\bigcap B \subseteq \bigcap A$.
\end{proof}
\subsection{\unverified{General Distributive Laws}}%
\hyperlabel{sub:general-distributive-laws}
For any sets $A$ and $\mathscr{B}$,
\begin{align*}
A \cup \bigcap \mathscr{B} & =
\bigcap\; \{ A \cup X \mid X \in \mathscr{B} \}
\quad\text{for}\quad \mathscr{B} \neq \emptyset \\
A \cap \bigcup \mathscr{B} & =
\bigcup\; \{ A \cap X \mid X \in \mathscr{B} \}
\end{align*}
\begin{proof}
Let $A$ and $\mathscr{B}$ be sets.
We prove that
\begin{enumerate}[(i)]
\item For $\mathscr{B} \neq \emptyset$,
$A \cup \bigcap \mathscr{B} =
\bigcap\; \{ A \cup X \mid X \in \mathscr{B} \}$.
\item $A \cap \bigcup \mathscr{B} =
\bigcup\; \{ A \cap X \mid X \in \mathscr{B} \}$
\end{enumerate}
\paragraph{(i)}%
Suppose $\mathscr{B}$ is nonempty.
Then $\bigcap \mathscr{B}$ is defined.
By definition of the union and intersection of sets,
\begin{align*}
A \cup \bigcap \mathscr{B}
& = \{ x \mid x \in A \lor x \in \bigcap \mathscr{B} \} \\
& = \{ x \mid x \in A \lor
x \in \{ y \mid (\forall b \in \mathscr{B}), y \in b \}\} \\
& = \{ x \mid x \in A \lor (\forall b \in \mathscr{B}), x \in b \} \\
& = \{ x \mid \forall b \in \mathscr{B}, x \in A \lor x \in b \} \\
& = \{ x \mid \forall b \in \mathscr{B}, x \in A \cup b \} \\
& = \{ x \mid
x \in \bigcap\; \{ A \cup X \mid X \in \mathscr{B} \}\} \\
& = \bigcap\; \{ A \cup X \mid X \in \mathscr{B} \}.
\end{align*}
\paragraph{(ii)}%
By definition of the intersection and union of sets,
\begin{align*}
A \cap \bigcup \mathscr{B}
& = \{ x \mid x \in A \land x \in \bigcup \mathscr{B} \} \\
& = \{ x \mid x \in A \land
x \in \{ y \mid (\exists b \in \mathscr{B}), y \in b \}\} \\
& = \{ x \mid x \in A \land (\exists b \in \mathscr{B}), x \in b \} \\
& = \{ x \mid \exists b \in \mathscr{B}, x \in A \land x \in b \} \\
& = \{ x \mid \exists b \in \mathscr{B} x \in A \cap b \} \\
& = \{ x \mid
x \in \bigcup\; \{ A \cap X \mid X \in \mathscr{B} \}\} \\
& = \bigcup\; \{ A \cap X \mid X \in \mathscr{B} \}.
\end{align*}
\end{proof}
\subsection{\unverified{General De Morgan's Laws}}%
\hyperlabel{sub:general-de-morgans-laws}
For any set $C$ and $\mathscr{A} \neq \emptyset$,
\begin{align*}
C - \bigcup \mathscr{A} & = \bigcap\; \{ C - X \mid X \in \mathscr{A} \} \\
C - \bigcap \mathscr{A} & = \bigcup\; \{ C - X \mid X \in \mathscr{A} \}
\end{align*}
\begin{proof}
Let $C$ and $\mathscr{A}$ be sets such that $\mathscr{A} \neq \emptyset$.
We prove that
\begin{enumerate}[(i)]
\item $C - \bigcup \mathscr{A} =
\bigcap\; \{ C - X \mid X \in \mathscr{A} \}$
\item $C - \bigcap \mathscr{A} =
\bigcup\; \{ C - X \mid X \in \mathscr{A} \}$
\end{enumerate}
\paragraph{(i)}%
By definition of the relative complement, union, and intersection of sets,
\begin{align*}
C - \bigcup \mathscr{A}
& = \{ x \mid x \in C \land x \not\in \bigcup \mathscr{A} \} \\
& = \{ x \mid x \in C \land
x \not\in \{ y \mid (\exists b \in \mathscr{A}) y \in b \}\} \\
& = \{ x \mid x \in C \land
\neg(\exists b \in \mathscr{A}, x \in b) \} \\
& = \{ x \mid x \in C \land
(\forall b \in \mathscr{A}, x \not\in b) \} \\
& = \{ x \mid
\forall b \in \mathscr{A}, x \in C \land x \not\in b \} \\
& = \{ x \mid \forall b \in \mathscr{A}, x \in C - b \} \\
& = \{ x \mid x \in \bigcap\; \{ C - X \mid X \in \mathscr{A} \} \\
& = \bigcap\; \{ C - X \mid X \in \mathscr{A} \}.
\end{align*}
\paragraph{(ii)}%
By definition of the relative complement, union, and intersection of sets,
\begin{align*}
C - \bigcap \mathscr{A}
& = \{ x \mid x \in C \land x \not\in \bigcap \mathscr{A} \} \\
& = \{ x \mid x \in C \land
x \not\in \{ y \mid (\forall b \in \mathscr{A}) y \in b \}\} \\
& = \{ x \mid x \in C \land
\neg(\forall b \in \mathscr{A}, x \in b) \} \\
& = \{ x \mid x \in C \land
\exists b \in \mathscr{A}, x \not\in b \} \\
& = \{ x \mid
\exists b \in \mathscr{A}, x \in C \land x \not\in b \} \\
& = \{ x \mid \exists b \in \mathscr{A}, x \in C - b \} \\
& = \{ x \mid x \in \bigcup\; \{ C - X \mid X \in \mathscr{A} \} \} \\
& = \bigcup\; \{ C - X \mid X \in \mathscr{A} \}.
\end{align*}
\end{proof}
\subsection{\verified{%
\texorpdfstring{$\cap$/$-$}{Intersection/Difference} Associativity}}%
\hyperlabel{sub:intersection-difference-associativity}
Let $A$, $B$, and $C$ be sets.
Then $A \cap (B - C) = (A \cap B) - C$.
\begin{proof}
\lean{Mathlib/Data/Set/Basic}{Set.inter\_diff\_assoc}
Let $A$, $B$, and $C$ be sets.
By definition of the intersection and relative complement of sets,
\begin{align*}
A \cap (B - C)
& = \{ x \mid x \in A \land x \in B - C \} \\
& = \{ x \mid x \in A \land (x \in B \land x \not\in C) \} \\
& = \{ x \mid (x \in A \land x \in B) \land x \not\in C \} \\
& = \{ x \mid x \in A \cap B \land x \not \in C \} \\
& = (A \cap B) - C.
\end{align*}
\end{proof}
\subsection{\verified{Nonmembership of Symmetric Difference}}
\hyperlabel{sub:nonmembership-symmetric-difference}
Let $A$ and $B$ be sets. $x \not\in A + B$ if and only if either
$x \in A \cap B$ or $x \not\in A \cup B$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Basic}
{Set.not\_mem\_symm\_diff\_inter\_or\_not\_union}
By definition of the \nameref{ref:symmetric-difference},
\begin{align*}
x \not\in A + B
& = \neg(x \in A + B) \\
& = \neg[x \in (A - B) \cup (B - A)] \\
& = \neg[x \in (A - B) \lor x \in (B - A)] \\
& = \neg[(x \in A \land x \not\in B) \lor
(x \in B \land x \not\in A)] \\
& = \neg(x \in A \land x \not\in B) \land
\neg(x \in B \land x \not\in A) \\
& = (x \not\in A \lor x \in B) \land (x \not\in B \lor x \in A) \\
& = ((x \not\in A \lor x \in B) \land x \not\in B) \lor
((x \not\in A \lor x \in B) \land x \in A) \\
& = (x \not\in A \land x \not\in B) \lor (x \in B \land x \in A) \\
& = \neg(x \in A \lor x \in B) \lor (x \in B \land x \in A) \\
& = x \not\in A \cup B \text{ or } x \in A \cap B.
\end{align*}
\end{proof}
\section{Exercises 2}%
\hyperlabel{sec:exercises-2}
\subsection{\verified{Exercise 2.1}}%
\hyperlabel{sub:exercise-2.1}
Assume that $A$ is the set of integers divisible by $4$.
Similarly assume that $B$ and $C$ are the sets of integers divisible by $9$ and
$10$, respectively.
What is in $A \cap B \cap C$?
\begin{answer}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_1}
The set of integers divisible by $4$, $9$, and $10$.
\end{answer}
\subsection{\verified{Exercise 2.2}}%
\hyperlabel{sub:exercise-2.2}
Give an example of sets $A$ and $B$ for which $\bigcup A = \bigcup B$ but
$A \neq B$.
\begin{answer}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_2}
Let $A = \{\{1\}, \{2\}\}$ and $B = \{\{1, 2\}\}$.
\end{answer}
\subsection{\verified{Exercise 2.3}}%
\hyperlabel{sub:exercise-2.3}
Show that every member of a set $A$ is a subset of $\bigcup A$.
(This was stated as an example in this section.)
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_3}
Let $x \in A$.
By definition, $$\bigcup A = \{ y \mid (\exists b \in A) y \in b\}.$$
Then $\{ y \mid y \in x\} \subseteq \bigcup A$.
But $\{ y \mid y \in x\} = x$.
Thus $x \subseteq \bigcup A$.
\end{proof}
\subsection{\verified{Exercise 2.4}}%
\hyperlabel{sub:exercise-2.4}
Show that if $A \subseteq B$, then $\bigcup A \subseteq \bigcup B$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_4}
Let $A$ and $B$ be sets such that $A \subseteq B$.
Let $x \in \bigcup A$.
By definition of the union, there exists some $b \in A$ such that $x \in b$.
By definition of the subset, $b \in B$.
This immediatley implies $x \in \bigcup B$.
Since this holds for all $x \in \bigcup A$, it follows
$\bigcup A \subseteq \bigcup B$.
\end{proof}
\subsection{\verified{Exercise 2.5}}%
\hyperlabel{sub:exercise-2.5}
Assume that every member of $\mathscr{A}$ is a subset of $B$.
Show that $\bigcup \mathscr{A} \subseteq B$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_5}
Let $x \in \bigcup \mathscr{A}$.
By definition,
$$\bigcup \mathscr{A} = \{ y \mid (\exists b \in A)y \in b \}.$$
Then there exists some $b \in A$ such that $x \in b$.
By hypothesis, $b \subseteq B$.
Thus $x$ must also be a member of $B$.
Since this holds for all $x \in \bigcup \mathscr{A}$, it follows
$\bigcup \mathscr{A} \subseteq B$.
\end{proof}
\subsection{\verified{Exercise 2.6a}}%
\hyperlabel{sub:exercise-2.6a}
Show that for any set $A$, $\bigcup \powerset{A} = A$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_6a}
We prove that (i) $\bigcup \powerset{A} \subseteq A$ and (ii)
$A \subseteq \bigcup \powerset{A}$.
\paragraph{(i)}%
\hyperlabel{par:exercise-2.6a-i}
By definition, the \nameref{ref:power-set} of $A$ is the set of all subsets
of $A$.
In other words, every member of $\powerset{A}$ is a subset of $A$.
By \nameref{sub:exercise-2.5}, $\bigcup \powerset{A} \subseteq A$.
\paragraph{(ii)}%
\hyperlabel{par:exercise-2.6a-ii}
Let $x \in A$.
By definition of the power set of $A$, $\{x\} \in \powerset{A}$.
By definition of the union,
$$\bigcup \powerset{A} =
\{ y \mid (\exists b \in \powerset{A}), y \in b).$$
Since $x \in \{x\}$ and $\{x\} \in \powerset{A}$, it follows
$x \in \bigcup \powerset{A}$.
Thus $A \subseteq \bigcup \powerset{A}$.
\paragraph{Conclusion}%
By \nameref{par:exercise-2.6a-i} and \nameref{par:exercise-2.6a-ii},
$\bigcup \powerset{A} = A$.
\end{proof}
\subsection{\verified{Exercise 2.6b}}%
\hyperlabel{sub:exercise-2.6b}
Show that $A \subseteq \powerset{\bigcup A}$.
Under what conditions does equality hold?
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_6b}
Let $x \in A$.
By \nameref{sub:exercise-2.3}, $x$ is a subset of $\bigcup A$.
By the definition of the \nameref{ref:power-set},
$$\powerset{\bigcup A} = \{ y \mid y \subseteq \bigcup A \}.$$
Therefore $x \in \powerset{\bigcup A}$.
Since this holds for all $x \in A$, $A \subseteq \powerset{\bigcup A}$.
\suitdivider
We show equality holds if and only if there exists some set $B$ such that
$A = \powerset{B}$.
\paragraph{($\Rightarrow$)}%
\hyperlabel{par:exercise-2.6b-right}
Suppose $A = \powerset{\bigcup A}$.
Then our statement immediately follows by settings $B = \bigcup A$.
\paragraph{($\Leftarrow$)}%
\hyperlabel{par:exercise-2.6b-left}
Suppose there exists some set $B$ such that $A = \powerset{B}$.
Therefore
\begin{align*}
\powerset{\bigcup A}
& = \powerset{\left(\bigcup {\powerset {B}}\right)} \\
& = \powerset{B} & \textref{sub:exercise-2.6a} \\
& = A.
\end{align*}
\paragraph{Conclusion}%
By \nameref{par:exercise-2.6b-right} and \nameref{par:exercise-2.6b-left},
$A = \powerset{\bigcup A}$ if and only if there exists some set $B$ such
that $A = \powerset{B}$.
\end{proof}
\subsection{\verified{Exercise 2.7a}}%
\hyperlabel{sub:exercise-2.7a}
Show that for any sets $A$ and $B$,
$$\powerset{A} \cap \powerset{B} = \powerset{(A \cap B)}.$$
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_7a}
Let $A$ and $B$ be arbitrary sets. We show that
$\powerset{A} \cap \powerset{B} \subseteq \powerset{(A \cap B)}$ and then
show that $\powerset{A} \cap \powerset{B} \supseteq \powerset{(A \cap B)}$.
\paragraph{($\subseteq$)}%
Let $x \in \powerset{A} \cap \powerset{B}$.
That is, $x \in \powerset{A}$ and $x \in \powerset{B}$.
By the definition of the \nameref{ref:power-set},
\begin{align*}
\powerset{A} & = \{ y \mid y \subseteq A \} \\
\powerset{B} & = \{ y \mid y \subseteq B \}
\end{align*}
Thus $x \subseteq A$ and $x \subseteq B$, meaning $x \subseteq A \cap B$.
But then $x \in \powerset{(A \cap B)}$, the set of all subsets of
$A \cap B$.
Since this holds for all $x \in \powerset{A} \cap \powerset{B}$, it follows
$$\powerset{A} \cap \powerset{B} \subseteq \powerset{(A \cap B)}.$$
\paragraph{($\supseteq$)}%
Let $x \in \powerset{(A \cap B)}$.
By the definition of the \nameref{ref:power-set},
$$\powerset{(A \cap B)} = \{ y \mid y \subseteq A \cap B \}.$$
Thus $x \subseteq A \cap B$, meaning $x \subseteq A$ and $x \subseteq B$.
But this implies $x \in \powerset{A}$, the set of all subsets of $A$.
Likewise $x \in \powerset{B}$, the set of all subsets of $B$.
Thus $x \in \powerset{A} \cap \powerset{B}$.
Since this holds for all $x \in \powerset{(A \cap B)}$, it follows
$$\powerset{(A \cap B)} \subseteq \powerset{A} \cap \powerset{B}.$$
\paragraph{Conclusion}%
Since each side of our identity is a subset of the other,
$$\powerset{(A \cap B)} = \powerset{A} \cap \powerset{B}.$$
\end{proof}
\subsection{\verified{Exercise 2.7b}}%
\hyperlabel{sub:exercise-2.7b}
Show that $\powerset{A} \cup \powerset{B} \subseteq \powerset{(A \cup B)}$.
Under what conditions does equality hold?
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_7b\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_7b\_ii}
Let $x \in \powerset{A} \cup \powerset{B}$.
By definition, $x \in \powerset{A}$ or $x \in \powerset{B}$ (or both).
By the definition of the \nameref{ref:power-set},
\begin{align*}
\powerset{A} &= \{ y \mid y \subseteq A \} \\
\powerset{B} &= \{ y \mid y \subseteq B \}.
\end{align*}
Thus $x \subseteq A$ or $x \subseteq B$.
Therefore $x \subseteq A \cup B$.
But then $x \in \powerset{(A \cup B)}$, the set of all subsets of $A \cup B$.
\suitdivider
We show equality holds if and only if one of $A$ or $B$ is a subset of the
other.
\paragraph{($\Rightarrow$)}%
\hyperlabel{par:exercise-2.7b-right}
Suppose
\begin{equation}
\hyperlabel{sub:exercise-2.7b-eq1}
\powerset{A} \cup \powerset{B} = \powerset{(A \cup B)}.
\end{equation}
By the definition of the \nameref{ref:power-set},
$A \cup B \in \powerset{(A \cup B)}$.
Then \eqref{sub:exercise-2.7b-eq1} implies
$A \cup B \in \powerset{A} \cup \powerset{B}$.
That is, $A \cup B \in \powerset{A}$ or $A \cup B \in \powerset{B}$ (or
both).
For the sake of contradiction, suppose $A \not\subseteq B$ and
$B \not\subseteq A$.
Then there exists an element $x \in A$ such that $x \not\in B$ and there
exists an element $y \in B$ such that $y \not\in A$.
But then $A \cup B \not\in \powerset{A}$ since $y$ cannot be a member of a
member of $\powerset{A}$.
Likewise, $A \cup B \not\in \powerset{B}$ since $x$ cannot be a member of a
member of $\powerset{B}$.
Therefore our assumption is incorrect.
In other words, $A \subseteq B$ or $B \subseteq A$.
\paragraph{($\Leftarrow$)}%
\hyperlabel{par:exercise-2.7b-left}
WLOG, suppose $A \subseteq B$.
Then, by \nameref{sub:exercise-1.3}, $\powerset{A} \subseteq \powerset{B}$.
Thus
\begin{align*}
\powerset{A} \cup \powerset{B}
& = \powerset{B} \\
& = \powerset{A \cup B}.
\end{align*}
\paragraph{Conclusion}%
By \nameref{par:exercise-2.7b-right} and \nameref{par:exercise-2.7b-left},
it follows
$\powerset{A} \cup \powerset{B} \subseteq \powerset{(A \cup B)}$ if and
only if $A \subseteq B$ or $B \subseteq A$.
\end{proof}
\subsection{\unverified{Exercise 2.8}}%
\hyperlabel{sub:exercise-2.8}
Show that there is no set to which every singleton (that is, every set of the
form $\{x\}$) belongs.
[\textit{Suggestion}: Show that from such a set, we could construct a set to
which every set belonged.]
\begin{proof}
We proceed by contradiction.
Suppose there existed a set $A$ consisting of every singleton.
Then the \nameref{ref:union-axiom} suggests $\bigcup A$ is a set.
But this set is precisely the class of all sets, which is \textit{not} a set.
Thus our original assumption was incorrect.
That is, there is no set to which every singleton belongs.
\end{proof}
\subsection{\verified{Exercise 2.9}}%
\hyperlabel{sub:exercise-2.9}
Give an example of sets $a$ and $B$ for which $a \in B$ but
$\powerset{a} \not\in \powerset{B}$.
\begin{answer}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_9}
Let $a = \{1\}$ and $B = \{\{1\}\}$.
Then
\begin{align*}
\powerset{a} & = \{\emptyset, \{1\}\} \\
\powerset{B} & = \{\emptyset, \{\{1\}\}\}.
\end{align*}
It immediately follows that $\powerset{a} \not\in \powerset{B}$.
\end{answer}
\subsection{\verified{Exercise 2.10}}%
\hyperlabel{sub:exercise-2.10}
Show that if $a \in B$, then $\powerset{a} \in \powerset{\powerset{\bigcup B}}$.
[\textit{Suggestion}: If you need help, look in the Appendix.]
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_10}
Suppose $a \in B$.
By \nameref{sub:exercise-2.3}, $a \subseteq \bigcup B$.
By \nameref{sub:exercise-1.3}, $\powerset{a} \subseteq \powerset{\bigcup B}$.
By the definition of the \nameref{ref:power-set},
$$\powerset{\powerset{\bigcup B}} =
\{ y \mid y \subseteq \powerset{\bigcup B} \}.$$
Therefore $\powerset{a} \in \powerset{\powerset{\bigcup B}}$.
\end{proof}
\subsection{\verified{Exercise 2.11}}%
\hyperlabel{sub:exercise-2.11}
Show that for any sets $A$ and $B$,
$$A = (A \cap B) \cup (A - B) \quad\text{and}\quad
A \cup (B - A) = A \cup B.$$
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_11\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_11\_ii}
\noindent Let $A$ and $B$ be sets.
We prove that
\begin{enumerate}[(i)]
\item $A = (A \cap B) \cup (A - B)$
\item $A \cup (B - A) = A \cup B$
\end{enumerate}
\paragraph{(i)}%
By definition of the intersection, union, and relative complements of sets,
\begin{align*}
(A \cap B) \cup (A - B)
& = \{ x \mid x \in A \cap B \lor x \in A - B \} \\
& = \{ x \mid x \in \{ y \mid y \in A \land y \in B \} \lor
x \in A - B \} \\
& = \{ x \mid (x \in A \land x \in B) \lor x \in A - B \} \\
& = \{ x \mid (x \in A \land x \in B) \lor
x \in \{ y \mid y \in A \land y \not\in B \} \} \\
& = \{ x \mid (x \in A \land x \in B) \lor
(x \in A \land x \not\in B) \} \\
& = \{ x \mid x \in A \lor (x \in B \land x \not\in B) \} \\
& = \{ x \mid x \in A \lor F \} \\
& = \{ x \mid x \in A \} \\
& = A.
\end{align*}
\paragraph{(ii)}%
By definition of the union and relative complements of sets,
\begin{align*}
A \cup (B - A)
& = \{ x \mid x \in A \lor x \in B - A \} \\
& = \{ x \mid x \in A \lor
x \in \{ y \mid y \in B \land y \not\in A \} \} \\
& = \{ x \mid x \in A \lor (x \in B \land x \not\in A) \} \\
& = \{ x \mid (x \in A \lor x \in B) \land
(x \in A \lor x \not\in A) \} \\
& = \{ x \mid (x \in A \lor x \in B) \land T \} \\
& = \{ x \mid x \in A \lor x \in B \} \\
& = \{ x \mid x \in A \cup B \} \\
& = A \cup B.
\end{align*}
\end{proof}
\subsection{\verified{Exercise 2.12}}%
\hyperlabel{sub:exercise-2.12}
Verify the following identity (one of De Morgan's laws):
$$C - (A \cap B) = (C - A) \cup (C - B).$$
\begin{proof}
Refer to \nameref{sub:de-morgans-laws}.
\end{proof}
\subsection{\verified{Exercise 2.13}}%
\hyperlabel{sub:exercise-2.13}
Show that if $A \subseteq B$, then $C - B \subseteq C - A$.
\begin{proof}
Refer to \nameref{sub:anti-monotonicity}.
\end{proof}
\subsection{\verified{Exercise 2.14}}%
\hyperlabel{sub:exercise-2.14}
Show by example that for some sets $A$, $B$, and $C$, the set $A - (B - C)$ is
different from $(A - B) - C$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_14}
Let $A = \{1, 2, 3\}$, $B = \{2, 3, 4\}$, and $C = \{3, 4, 5\}$.
Then
\begin{align*}
A - (B - C)
& = \{1, 2, 3\} - (\{2, 3, 4\} - \{3, 4, 5\}) \\
& = \{1, 2, 3\} - \{2\} \\
& = \{1, 3\}
\end{align*}
but
\begin{align*}
(A - B) - C
& = (\{1, 2, 3\} - \{2, 3, 4\}) - \{3, 4, 5\} \\
& = \{1\} - \{3, 4, 5\} \\
& = \{1\}.
\end{align*}
\end{proof}
\subsection{\verified{Exercise 2.15a}}%
\hyperlabel{sub:exercise-2.15a}
Show that $A \cap (B + C) = (A \cap B) + (A \cap C)$.
\begin{proof}
\lean{Mathlib/Data/Set/Basic}{Set.inter\_symmDiff\_distrib\_left}
By definition of the intersection, \nameref{ref:symmetric-difference}, and
relative complement of sets,
\begin{align*}
(A & \cap B) + (A \cap C) \\
& = [(A \cap B) - (A \cap C)] \cup [(A \cap C) - (A \cap B)] \\
& = [(A \cap B) - A] \\
& \qquad \cup [(A \cap B) - C] \\
& \qquad \cup [(A \cap C) - A] \\
& \qquad \cup [(A \cap C) - B]
& \textref{sub:de-morgans-laws} \\
& = [A \cap (B - A)] \\
& \qquad \cup [A \cap (B - C)] \\
& \qquad \cup [A \cap (C - A)] \\
& \qquad \cup [A \cap (C - B)]
& \textref{sub:intersection-difference-associativity} \\
& = \emptyset \\
& \qquad \cup [A \cap (B - C)] \\
& \qquad \cup \emptyset \\
& \qquad \cup [A \cap (C - B)]
& \textref{sub:identitives-involving-empty-set} \\
& = [A \cap (B - C)] \cup [A \cap (C - B)] \\
& = A \cap [(B - C) \cup (C - B)]
& \textref{sub:distributive-laws} \\
& = A \cap (B + C).
\end{align*}
\end{proof}
\subsection{\verified{Exercise 2.15b}}%
\hyperlabel{sub:exercise-2.15b}
Show that $A + (B + C) = (A + B) + C$.
\begin{proof}
\lean{Mathlib/Data/Set/Basic}{Set.symmDiff\_assoc}
\noindent Let $A$, $B$, and $C$ be sets.
We prove that
\begin{enumerate}[(i)]
\item $A + (B + C) \subseteq (A + B) + C$
\item $(A + B) + C \subseteq A + (B + C)$
\end{enumerate}
\paragraph{(i)}%
\hyperlabel{par:exercise-2.15b-i}
Let $x \in A + (B + C)$.
Then $x$ is in $A$ or in $B + C$, but not both.
There are two cases to consider:
\subparagraph{Case 1}%
Suppose $x \in A$ and $x \not\in B + C$.
Then, by \nameref{sub:nonmembership-symmetric-difference},
(a) $x \in B \cap C$ or (b) $x \not\in B \cup C$.
Suppose (a) was true.
That is, $x \in B$ and $x \in C$.
Since $x$ is a member of $A$ and $B$, $x \not\in (A + B)$.
Since $x$ is not a member of $A + B$ but is a member of $C$,
$x \in (A + B) + C$.
Now suppose (b) was true.
That is, $x \not\in B$ and $x \not\in C$.
Since $x$ is a member of $A$ but not $B$, $x \in (A + B)$.
Since $x$ is a member of $A + B$ but not $C$, $x \in (A + B) + C$.
\subparagraph{Case 2}%
Suppose $x \in B + C$ and $x \not\in A$.
Then (a) $x \in B$ or (b) $x \in C$ but not both.
Suppose (a) was true.
That is, $x \in B$ and $x \not\in C$.
Since $x$ is not a member of $A$ and is a member of $B$, $x \in A + B$.
Since $x$ is a member of $A + B$ but not $C$, $x \in (A + B) + C$.
Now suppose (b) was true.
That is, $x \not\in B$ and $x \in C$.
Since $x$ is not a member of $A$ nor a member of $B$, $x \not\in A + B$.
Since $x$ is not a member of $A + B$ but is a member of $C$,
$x \in (A + B) + C$.
\paragraph{(ii)}%
\hyperlabel{par:exercise-2.15b-ii}
Let $x \in (A + B) + C$.
Then $x$ is in $A + B$ or in $C$, but not both.
There are two cases to consider:
\subparagraph{Case 1}%
Suppose $x \in A + B$ and $x \not\in C$.
Then (a) $x \in A$ or (b) $x \in B$ but not both.
Suppose (a) was true.
That is, $x \in A$ and $x \not\in B$.
Since $x$ is not a member of $B$ nor $C$, $x \not\in B + C$.
Since $x$ is not a member of $B + C$ but is a member of $A$,
$x \in A + (B + C)$.
Now Suppose (b) was true.
That is, $x \not\in A$ and $x \in B$.
Since $x$ is a member of $B$ and not of $C$, then $x \in B + C$.
Since $x$ is a member of $B + C$ and not of $A$, $x \in A + (B + C)$.
\subparagraph{Case 2}%
Suppose $x \not\in A + B$ and $x \in C$.
Then, by \nameref{sub:nonmembership-symmetric-difference},
(a) $x \in A \cap B$ or (b) $x \not\in A \cup B$.
Suppose (a) was true.
That is, $x \in A \land x \in B$.
Since $x$ is a member of $B$ and $C$, $x \not\in B + C$.
Since $x$ is not a member of $B + C$ but is a member of $A$,
$x \in A + (B + C)$.
Now suppose (b) was true.
That is, $x \not\in A$ and $x \not\in B$.
Since $x$ is not a member of $B$ but is a member of $C$, $x \in B + C$.
Since $x$ is a member of $B + C$ but not of $A$, $x \in A + (B + C)$.
\paragraph{Conclusion}%
In both \nameref{par:exercise-2.15b-i} and \nameref{par:exercise-2.15b-ii},
the subcases are exhaustive and prove the desired subset relation.
Therefore $A + (B + C) = (A + B) + C$.
\end{proof}
\subsection{\verified{Exercise 2.16}}%
\hyperlabel{sub:exercise-2.16}
Simplify:
$$[(A \cup B \cup C) \cap (A \cup B)] - [(A \cup (B - C)) \cap A].$$
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_16}
Let $A$, $B$, and $C$ be arbitrary sets.
Then
\begin{align*}
[(A \cup B \cup C) \cap (A \cup B)] & - [(A \cup (B - C)) \cap A] \\
& = [A \cup B] - [A] \\
& = \{ x \mid x \in (A \cup B) \land x \not\in A \} \\
& = \{ x \mid x \in \{ y \mid y \in A \lor y \in B \} \land x \not\in A \} \\
& = \{ x \mid (x \in A \lor x \in B) \land x \not\in A \} \\\
& = \{ x \mid (x \in A \land x \not\in A) \lor (x \in B \land x \not\in A) \} \\
& = \{ x \mid F \lor (X \in B \land x \not\in A) \} \\
& = \{ x \mid x \in B \land x \not\in A \} \\
& = B - A.
\end{align*}
\end{proof}
\subsection{\verified{Exercise 2.17}}%
\hyperlabel{sub:exercise-2.17}
Show that the following four conditions are equivalent.
\begin{enumerate}[(a)]
\item $A \subseteq B$,
\item $A - B = \emptyset$,
\item $A \cup B = B$,
\item $A \cap B = A$.
\end{enumerate}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_17\_i}
\lean*{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_17\_ii}
\lean*{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_17\_iii}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_17\_iv}
Let $A$ and $B$ be arbitrary sets.
We show that (i) $(a) \Rightarrow (b)$, (ii) $(b) \Rightarrow (c)$, (iii)
$(c) \Rightarrow (d)$, and (iv) $(d) \Rightarrow (a)$.
\paragraph{(i)}%
Suppose $A \subseteq B$.
That is, $\forall t, t \in A \Rightarrow t \in B$.
Then there is no element such that $t \in A$ and $t \not\in B$.
By definition of the relative complement, this immediately implies
$A - B = \emptyset$.
\paragraph{(ii)}%
Suppose $A - B = \emptyset$.
By definition of the relative complement,
$$A - B = \emptyset = \{ x \mid x \in A \land x \not\in B \}.$$
Then, for all $t$,
$\neg(t \in A \land t \not\in B) = t \not\in A \lor t \in B$.
This implies, by definition of the subset, that $A \subseteq B$.
It then immediately follows that $A \cup B = B$.
\paragraph{(iii)}%
Suppose $A \cup B = B$.
Then there is no member of $A$ that is not a member of $B$.
In other words, $A \subseteq B$.
This immediately implies $A \cap B = A$.
\paragraph{(iv)}%
Suppose $A \cap B = A$.
Then every member of $A$ is a member of $B$.
This immediately implies $A \subseteq B$.
\end{proof}
\subsection{\unverified{Exercise 2.18}}%
\hyperlabel{sub:exercise-2.18}
Assume that $A$ and $B$ are subsets of $S$.
List all of the different sets that can be made from these three by use of the
binary operations $\cup$, $\cap$, and $-$.
\begin{proof}
We can reason about this diagrammatically:
\begin{figure}[ht]
\includegraphics[width=0.6\textwidth]{venn-diagram}
\centering
\end{figure}
In the above diagram, we assume the left circle corresponds to set $A$ and the
right circle corresponds to $B$.
The the possible sets we can make via the specified operators are:
\begin{itemize}
\item $A - B$, the left circle excluding the overlapping region.
\item $A \cap B$, the overlapping region.
\item $B - A$, the right circle excluding the overlapping region.
\item $(A \cup B) \cap A$, the left circle.
\item $(A \cup B) \cap B$, the right circle.
\item $(A - B) \cup (B - A)$, the symmetric difference.
\item $A \cup B$, the entire diagram.
\end{itemize}
\end{proof}
\subsection{\verified{Exercise 2.19}}%
\hyperlabel{sub:exercise-2.19}
Is $\powerset{(A - B)}$ always equal to $\powerset{A} - \powerset{B}$?
Is it ever equal to $\powerset{A} - \powerset{B}$?
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_19}
Let $A$ and $B$ be arbitrary sets.
We show (i) that $\emptyset \in \powerset{(A - B})$ and (ii)
$\emptyset \not\in \powerset{A} - \powerset{B}$.
\paragraph{(i)}%
\hyperlabel{par:exercise-2.19-i}
By definition of the \nameref{ref:power-set},
$$\powerset{(A - B)} = \{ x \mid x \subseteq A - B \}.$$
But $\emptyset$ is a subset of \textit{every} set.
Thus $\emptyset \in \powerset{(A - B)}$.
\paragraph{(ii)}%
By the same reasoning found in \nameref{par:exercise-2.19-i},
$\emptyset \in \powerset{A}$ and $\emptyset \in \powerset{B}$.
But then, by definition of the relative complement,
$\emptyset \not\in \powerset{A} - \powerset{B}$.
\paragraph{Conclusion}%
By the \nameref{ref:extensionality-axiom}, the two sets are never equal.
\end{proof}
\subsection{\verified{Exercise 2.20}}%
\hyperlabel{sub:exercise-2.20}
Let $A$, $B$, and $C$ be sets such that $A \cup B = A \cup C$ and
$A \cap B = A \cap C$.
Show that $B = C$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_20}
Let $A$, $B$, and $C$ be arbitrary sets.
By the \nameref{ref:extensionality-axiom}, $B = C$ if and only if for all sets
$x$, $x \in B \iff x \in C$.
We prove both directions of this biconditional.
\paragraph{($\Rightarrow$)}%
Suppose $x \in B$.
Then there are two cases to consider:
\subparagraph{Case 1}%
Assume $x \in A$.
Then $x \in A \cap B$.
By hypothesis, $A \cap B = A \cap C$.
Thus $x \in A \cap C$ immediately implying $x \in C$.
\subparagraph{Case 2}%
Assume $x \not\in A$.
Then $x \in A \cup B$.
By hypothesis, $A \cup B = A \cup C$.
Thus $x \in A \cup C$.
Since $x \not\in A$, it follows $x \in C$.
\paragraph{($\Leftarrow$)}%
Suppose $x \in C$.
Then there are two cases to consider:
\subparagraph{Case 1}%
Assume $x \in A$.
Then $x \in A \cap C$.
By hypothesis, $A \cap B = A \cap C$.
Thus $x \in A \cap B$, immediately implying $x \in B$.
\subparagraph{Case 2}%
Assume $x \not\in A$.
Then $x \in A \cup C$.
By hypothesis, $A \cup B = A \cup C$.
Thus $x \in A \cup B$.
Since $x \not\in A$, it follows $x \in B$.
\end{proof}
\subsection{\verified{Exercise 2.21}}%
\hyperlabel{sub:exercise-2.21}
Show that $\bigcup (A \cup B) = \bigcup A \cup \bigcup B$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_21}
Let $A$ and $B$ be arbitrary sets.
By the \nameref{ref:extensionality-axiom}, the specified equality holds if and
only if for all sets $x$,
$$x \in \bigcup (A \cup B) \iff x \in \bigcup A \cup \bigcup B.$$
We prove both directions of this biconditional.
\paragraph{($\Rightarrow$)}%
Suppose $x \in \bigcup (A \cup B)$.
By definition of the union of sets, there exists some $b \in A \cup B$ such
that $x \in b$.
If $b \in A$, then $x \in \bigcup A$ and $x \in \bigcup A \cup \bigcup B$.
Alternatively, if $b \in B$, then $x \in \bigcup B$ and
$x \in \bigcup A \cup \bigcup B$.
Regardless, $x$ is in the target set.
\paragraph{($\Leftarrow$)}%
Suppose $x \in \bigcup A \cup \bigcup B$.
Then $x \in \bigcup A$ or $x \in \bigcup B$.
WLOG, suppose $x \in \bigcup A$.
By definition of the union of sets, there exists some $b \in A$ such that
$x \in b$.
But then $b \in A \cup B$ meaning $x$ is also a member of
$\bigcup (A \cup B)$.
\end{proof}
\subsection{\verified{Exercise 2.22}}%
\hyperlabel{sub:exercise-2.22}
Show that if $A$ and $B$ are nonempty sets, then
$\bigcap (A \cup B) = \bigcap A \cap \bigcap B$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_22}
Let $A$ and $B$ be arbitrary, nonempty sets.
By the \nameref{ref:extensionality-axiom}, the specified equality holds if and
only if for all sets $x$,
\begin{equation}
\hyperlabel{sub:exercise-2.22-eq1}
x \in \bigcap (A \cup B) \iff x \in \bigcap A \cap \bigcap B.
\end{equation}
We prove both directions of this biconditional.
\paragraph{($\Rightarrow$)}%
Suppose $x \in \bigcap (A \cup B)$.
Then for all $b \in A \cup B$, $x \in B$.
In other words, for every member $b_1$ of $A$ and every member $b_2$ of $B$,
$x$ is a member of both $b_1$ and $b_2$.
But that implies $x \in \bigcap A$ and $x \in \bigcap B$.
\paragraph{($\Leftarrow$)}%
Suppose $x \in \bigcap A \cap \bigcap B$.
That is, $x \in \bigcap A$ and $x \in \bigcap B$.
By definition of the intersection of sets, forall sets $b$, if $b \in A$,
then $x \in b$.
Likewise, if $b \in B$, then $x \in b$.
In other words, if $b$ is a member of either $A$ or $B$, $x \in b$.
That immediately implies $x \in \bigcap (A \cup B$.
\end{proof}
\subsection{\unverified{Exercise 2.23}}%
\hyperlabel{sub:exercise-2.23}
Show that if $\mathscr{B}$ is nonempty, then
$A \cup \bigcap \mathscr{B} = \bigcap\; \{A \cup X \mid X \in \mathscr{B} \}$.
\begin{proof}
Refer to \nameref{sub:general-distributive-laws}.
\end{proof}
\subsection{\verified{Exercise 2.24a}}%
\hyperlabel{sub:exercise-2.24a}
Show that if $\mathscr{A}$ is nonempty, then
$\powerset{\bigcap\mathscr{A}} =
\bigcap\; \{\powerset{X} \mid X \in \mathscr{A} \}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_24a}
Suppose $\mathscr{A}$ is a nonempty set.
Then $\bigcap \mathscr{A}$ is well-defined.
Therefore
\begin{align*}
\powerset{\bigcap\mathscr{A}}
& = \{ x \mid x \subseteq \bigcap \mathscr{A} \}
& \textref{ref:power-set} \\
& = \{ x \mid x \subseteq
\{ y \mid \forall X \in \mathscr{A}, y \in X \} \}
& \text{def'n intersection} \\
& = \{ x \mid \forall t \in x,
t \in \{ y \mid \forall X \in \mathscr{A}, y \in X \} \}
& \text{def'n subset} \\
& = \{ x \mid \forall t \in x,
(\forall X \in \mathscr{A}, t \in X) \} \\
& = \{ x \mid \forall X \in \mathscr{A},
(\forall t \in x, t \in X) \} \\
& = \{ x \mid \forall X \in \mathscr{A}, x \subseteq X \} \\
& = \{ x \mid \forall X \in \mathscr{A}, x \in \powerset{X} \}
& \textref{ref:power-set-axiom} \\
& = \{ x \mid
\forall t \in \{ \powerset{X} \mid X \in \mathscr{A} \}, x \in t \} \\
& = \bigcap\; \{\powerset{X} \mid X \in \mathscr{A}\}.
\end{align*}
\end{proof}
\subsection{\verified{Exercise 2.24b}}%
\hyperlabel{sub:exercise-2.24b}
Show that
\begin{equation}
\hyperlabel{sub:exercise-2.24b-eq1}
\bigcup\; \{ \powerset{X} \mid X \in \mathscr{A} \} \subseteq
\powerset{\bigcup\mathscr{A}}.
\end{equation}
Under what conditions does equality hold?
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_24b}
We first prove \eqref{sub:exercise-2.24b-eq1}.
Let $x \in \bigcup\; \{ \powerset{X} \mid X \in \mathscr{A} \}$.
By definition of the union of sets,
$(\exists X \in \mathscr{A}), x \in \powerset{X}$.
By definition of the \nameref{ref:power-set}, $x \subseteq X$.
By \nameref{sub:exercise-2.3}, $X \subseteq \bigcup \mathscr{A}$.
Therefore $x \subseteq \bigcup \mathscr{A}$, proving
$x \in \powerset{\mathscr{A}}$ as expected.
\suitdivider
\noindent
We show $\powerset{\bigcup A} \subseteq
\bigcup\;\{ \powerset{X} \mid X \in \mathscr{A} \}$ if and only if
$\bigcup\mathscr{A} \in \mathscr{A}$.
\paragraph{($\Rightarrow$)}%
Suppose $\powerset{\bigcup\mathscr{A}} \subseteq
\bigcup\;\{ \powerset{X} \mid X \in \mathscr{A} \}$.
By definition of the \nameref{ref:power-set},
$\bigcup\mathscr{A} \in \powerset{\bigcup\mathscr{A}}$.
By hypothesis, $\bigcup\mathscr{A} \in
\bigcup\;\{ \powerset{X} \mid X \in \mathscr{A} \}$.
By definition of the union of sets, there exists some $X \in \mathscr{A}$
such that $\bigcup\mathscr{A} \in \powerset{X}$.
That is, $\bigcup\mathscr{A} \subseteq X$.
But $\bigcup\mathscr{A}$ cannot be a proper subset of $X$ since
$X \in \mathscr{A}$.
Thus $\bigcup\mathscr{A} = X$.
This proves $\bigcup\mathscr{A} \in
\bigcup\;\{ \powerset{X} \mid X \in \mathscr{A} \}$.
\paragraph{($\Leftarrow$)}%
Suppose $\bigcup\mathscr{A} \in A$.
Let $x \in \powerset{\bigcup\mathscr{A}}$.
Since $\bigcup\mathscr{A} \in \mathscr{A}$, it immediately follows that
$x \in \{\powerset{X} \mid X \in \mathscr{A}\}$.
\paragraph{Conclusion}%
Equality follows immediately from this fact in conjunction with the proof
of \eqref{sub:exercise-2.24b-eq1}.
\end{proof}
\subsection{\verified{Exercise 2.25}}%
\hyperlabel{sub:exercise-2.25}
Is $A \cup \bigcup \mathscr{B}$ always the same as
$\bigcup\;\{ A \cup X \mid X \in \mathscr{B} \}$?
If not, then under what conditions does equality hold?
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_2}
{Enderton.Set.Chapter\_2.exercise\_2\_25}
We prove that
\begin{equation}
\hyperlabel{sub:exercise-2.25-eq1}
A \cup \bigcup \mathscr{B} =
\bigcup\;\{ A \cup X \mid X \in \mathscr{B} \}
\end{equation}
if and only if $A = \emptyset$ or $\mathscr{B} \neq \emptyset$.
We prove both directions of this biconditional.
\paragraph{($\Rightarrow$)}%
Suppose \eqref{sub:exercise-2.25-eq1} holds true.
There are two cases to consider:
\subparagraph{Case 1}%
Suppose $B \neq \emptyset$.
Then $A = \emptyset \lor \mathscr{B} \neq \emptyset$ holds trivially.
\subparagraph{Case 2}%
Suppose $B = \emptyset$.
Then $$A \cup \bigcup \mathscr{B} = A \cup \bigcup \emptyset = A$$ and
$$
\bigcup\;\{ A \cup X \mid X \in \mathscr{B} \}
= \bigcup \emptyset \\
= \emptyset.
$$
Then by hypothesis \eqref{sub:exercise-2.25-eq1}, $A = \emptyset$.
Then $A = \emptyset \lor \mathscr{B} \neq \emptyset$ holds trivially.
\paragraph{($\Leftarrow$)}%
Suppose $A = \emptyset$ or $\mathscr{B} \neq \emptyset$.
There are two cases to consider:
\paragraph{Case 1}%
Suppose $A = \emptyset$.
Then $A \cup \bigcup \mathscr{B} = \bigcup{\mathscr{B}}$.
Likewise,
$$
\bigcup \{ A \cup X \mid X \in \mathscr{B} \}
= \bigcup \{ X \mid X \in \mathscr{B} \} \\
= \bigcup \mathscr{B}.
$$
Therefore \eqref{sub:exercise-2.25-eq1} holds.
\paragraph{Case 2}%
Suppose $B \neq \emptyset$.
Then
\begin{align*}
A \cup \bigcup\mathscr{B}
& = \{ x \mid x \in A \lor x \in \bigcup\mathscr{B} \} \\
& = \{ x \mid x \in A \lor (\exists b \in \mathscr{B}) x \in b \} \\
& = \{ x \mid (\exists b \in \mathscr{B}) x \in A \lor x \in b \} \\
& = \{ x \mid (\exists b \in \mathscr{B}) x \in A \cup b \} \\
& = \{ x \mid x \in \bigcup \{ A \cup X \mid X \in \mathscr{B} \} \\
& = \bigcup \{ A \cup X \mid X \in \mathscr{B} \}.
\end{align*}
Therefore \eqref{sub:exercise-2.25-eq1} holds.
\end{proof}
\chapter{Relations and Functions}%
\hyperlabel{chap:relations-functions}
\section{Ordered Pairs}%
\hyperlabel{sec:ordered-pairs}
\subsection{\verified{Theorem 3A}}%
\hyperlabel{sub:theorem-3a}
\begin{theorem}[3A]
For any sets $x$, $y$, $u$, and $v$,
\begin{equation}
\hyperlabel{sub:theorem-3a-eq1}
\pair{u, v} = \pair{x, y} \iff u = x \land v = y.
\end{equation}
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.OrderedPair.ext\_iff}
Let $x$, $y$, $u$, and $v$ be arbitrary sets.
\paragraph{($\Leftarrow$)}%
This follows trivially.
\paragraph{($\Rightarrow$)}%
Suppose $\pair{u, v} = \pair{x, y}$.
Then, by definition of an \nameref{ref:ordered-pair},
\begin{equation}
\hyperlabel{sub:theorem-3a-eq2}
\{\{u\}, \{u, v\}\} = \{\{x\}, \{x, y\}\}.
\end{equation}
By the \nameref{ref:extensionality-axiom}, it follows
$\{u\} \in \{\{x\}, \{x, y\}\}$ and
$\{u, v\} \in \{\{x\}, \{x, y\}\}$.
That is,
$$\{u\} = \{x\} \quad\text{or}\quad \{u\} = \{x, y\}$$
and
$$\{u, v\} = \{x\} \quad\text{or}\quad \{u, v\} = \{x, y\}.$$
There are 4 cases to consider:
\paragraph{Case 1}%
Suppose $\{u\} = \{x\}$ and $\{u, v\} = \{x\}$.
The former identity implies $u = x$.
The latter identity implies $u = v = x$.
Then \eqref{sub:theorem-3a-eq2} simplifies to
$$\{\{u\}\} = \{\{x\}, \{x, y\}\},$$ meaning $x = y$.
Thus $v = y$ as well.
\paragraph{Case 2}%
Suppose $\{u\} = \{x\}$ and $\{u, v\} = \{x, y\}$.
The former identity implies $u = x$.
Substituting into the latter identity yields $\{u, v\} = \{u, y\}$.
This holds if and only if $v = y$.
\paragraph{Case 3}%
Suppose $\{u\} = \{x, y\}$ and $\{u, v\} = \{x\}$.
The former identity implies $x = y = u$.
Substituting into the latter yields $\{u, v\} = \{u\}$.
Thus $u = v$ which in turn implies $v = y$.
\paragraph{Case 4}%
Suppose $\{u\} = \{x, y\}$ and $\{u, v\} = \{x, y\}$.
The former identity implies $x = y = u$.
Substituting into the latter yields $\{u, v\} = \{u\}$.
This implies $v = u$ which in turn implies $v = y$.
\paragraph{Conclusion}%
These cases are exhaustive and each implies that $u = x$ and $v = y$.
\end{proof}
\subsection{\verified{Lemma 3B}}%
\hyperlabel{sub:lemma-3b}
\begin{theorem}[3B]
If $x \in C$ and $y \in C$, then $\pair{x, y} \in \powerset{\powerset{C}}$.
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3b}
Let $C$ be an arbitrary set and $x, y \in C$.
Then, by definition of the \nameref{ref:power-set},
$\{x\}$ and $\{x, y\}$ are members of $\powerset{C}$.
Likewise, $\{\{x\}, \{x, y\}\}$ is a member of $\powerset{\powerset{C}}$.
By definition of an \nameref{ref:ordered-pair},
$\pair{x, y} = \{\{x\}, \{x, y\}\}$.
This concludes our proof.
\end{proof}
\subsection{\verified{Corollary 3C}}%
\hyperlabel{sub:corollary-3c}
\begin{theorem}[3C]
For any sets $A$ and $B$, there is a set whose members are exactly the
pairs $\pair{x, y}$ with $x \in A$ and $y \in B$.
\end{theorem}
\begin{proof}
\lean*{Mathlib/SetTheory/ZFC/Basic}{Set.prod}
\begin{note}
The above Lean proof is a definition (i.e. an axiom).
It does not prove such a set's existence from first principles.
\end{note}
Define $C = A \cup B$.
Then for all $x \in A$ and for all $y \in B$, $x$ and $y$ are both in $C$.
By \nameref{sub:lemma-3b}, it follows that
$\pair{x, y} \in \powerset{\powerset{C}}$.
The \nameref{ref:power-set-axiom} indicates $\powerset{\powerset{C}}$ is
indeed a set.
Therefore the \nameref{ref:subset-axioms} are applicable.
This implies the existence of a set $D$ such that
$$\forall z, (z \in D \iff z \in \powerset{\powerset{C}} \land
(\exists x, \exists y, x \in A \land y \in B \land
z = \pair{x, y})).$$
By construction $D$ is the set whose members are exactly the pairs
$\pair{x, y}$ with $x \in A$ and $y \in B$.
\end{proof}
\section{Relations}%
\hyperlabel{sec:relations}
\subsection{\verified{Theorem 3D}}%
\hyperlabel{sub:theorem-3d}
\begin{theorem}[3D]
If $\pair{x, y} \in A$, then $x$ and $y$ belong to $\bigcup\bigcup A$.
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3d}
Let $A$ be a set and $\pair{x, y} \in A$.
By definition of an \nameref{ref:ordered-pair},
$$\pair{x, y} = \{\{x\}, \{x, y\}\}.$$
By \nameref{sub:exercise-2.3}, $\{\{x\}, \{x, y\}\} \subseteq \bigcup A$.
Then $\{x, y\} \in \bigcup A$.
Another application of \nameref{sub:exercise-2.3} implies
$\{x, y\} \subseteq \bigcup\bigcup A$.
Therefore $x, y \in \bigcup\bigcup A$.
\end{proof}
\section{Functions}%
\hyperlabel{sec:functions}
\subsection{\verified{Theorem 3E}}%
\hyperlabel{sub:theorem-3e}
\begin{theorem}[3E]
For a set $F$, $\dom{(F^{-1})} = \ran{F}$ and $\ran{(F^{-1})} = \dom{F}$.
For a relation $F$, $(F^{-1})^{-1} = F$.
\end{theorem}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}
{Set.Relation.dom\_inv\_eq\_ran\_self}
\lean*{Bookshelf/Enderton/Set/Relation}
{Set.Relation.ran\_inv\_eq\_dom\_self}
\lean{Bookshelf/Enderton/Set/Relation}
{Set.Relation.inv\_inv\_eq\_self}
We prove that (i) $\dom{(F^{-1})} = \ran{F}$, (ii) $\ran{(F^{-1})} = \dom{F}$,
and (iii) $(F^{-1})^{-1} = F$.
\paragraph{(i)}%
By definition of the \nameref{ref:domain}, $x \in \dom{(F^{-1})}$ if and
only if there exists some $y$ such that $\pair{x, y} \in F^{-1}$.
By definition of the \nameref{ref:inverse} of a set,
$\pair{y, x} \in F$.
By definition of the \nameref{ref:range}, $x \in \ran{F}$.
Since each step holds biconditionally, it follows
$\dom{(F^{-1})} = \ran{F}$ as expected.
\paragraph{(ii)}%
By definition of the \nameref{ref:range}, $x \in \ran{(F^{-1})}$ if and
only if there exists some $t$ such that $\pair{t, x} \in F^{-1}$.
By definition of the \nameref{ref:inverse} of a set,
$\pair{x, t} \in F$.
By definition of the \nameref{ref:domain}, $x \in \dom{F}$.
Since each step holds biconditionally, it follows
$\ran{(F^{-1})} = \dom{F}$.
\paragraph{(iii)}%
By definition of the \nameref{ref:inverse} of a set,
\begin{align*}
(F^{-1})^{-1}
& = \{\pair{u, v} \mid \pair{v, u} \in F^{-1}\} \\
& = \{\pair{u, v} \mid \pair{u, v} \in F\} \\
& = F.
\end{align*}
\end{proof}
\subsection{\verified{Theorem 3F}}%
\hyperlabel{sub:theorem-3f}
\begin{theorem}[3F]
For a set $F$, $F^{-1}$ is a function iff $F$ is single-rooted.
A relation $F$ is a function iff $F^{-1}$ is single-rooted.
\end{theorem}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}
{Set.Relation.single\_valued\_inv\_iff\_single\_rooted\_self}
\lean{Bookshelf/Enderton/Set/Relation}
{Set.Relation.single\_valued\_self\_iff\_single\_rooted\_inv}
We prove that (i) any set $F$, $F^{-1}$ is a function iff $F$ is
single-rooted and (ii) any relation $F$ is a function iff $F^{-1}$ is
single-rooted.
\paragraph{(i)}%
\hyperlabel{par:theorem-3f-i}
Let $F$ be any set.
\subparagraph{($\Rightarrow$)}%
Suppose $F^{-1}$ is a \nameref{ref:function}.
By definition, for each $x \in \dom{(F^{-1})}$, there is only one $y$
such that $\pair{x, y} \in F^{-1}$.
By definition of the \nameref{ref:inverse} of $F$,
$F^{-1} = \{\pair{u, v} \mid vFu\}$.
Then for each $x \in \ran{F}$, there exists exactly one $y$ such that
$\pair{y, x} \in F$.
This definitionally means $F$ is single-rooted.
\subparagraph{($\Leftarrow$)}%
Suppose $F$ is single-rooted.
By definition, for each $x \in \ran{F}$, there is only one $t$ such that
$\pair{t, x} \in F$.
By definition of the \nameref{ref:inverse} of $F$,
$F^{-1} = \{\pair{u, v} \mid vFu\}$.
Then for each $x \in \dom{(F^{-1})}$ there exists exactly one $t$ such
that $\pair{x, t} \in F^{-1}$.
This definitionally means $F^{-1}$ is a function.
\paragraph{(ii)}%
Let $F$ be a \nameref{ref:relation}.
\subparagraph{($\Rightarrow$)}%
Suppose $F$ is a function.
By \nameref{sub:theorem-3e}, $F = (F^{-1})^{-1}$.
Then by \nameref{par:theorem-3f-i}, $F^{-1}$ is single-rooted.
\subparagraph{($\Leftarrow$)}%
Suppose $F^{-1}$ is single-rooted.
Then by \nameref{par:theorem-3f-i}, $(F^{-1})^{-1}$ is a function.
By \nameref{sub:theorem-3e}, $(F^{-1})^{-1} = F$.
Thus $F$ is a function.
\end{proof}
\subsection{\verified{Lemma 1}}%
\hyperlabel{sub:lemma-1}
For any one-to-one function $F$, $F^{-1}$ is also one-to-one.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Relation}
{Set.Relation.one\_to\_one\_self\_iff\_one\_to\_one\_inv}
We prove that (i) $F^{-1}$ is a function and (ii) $F^{-1}$ is single-rooted.
\paragraph{(i)}%
\hyperlabel{par:lemma-1-i}
By hypothesis, $F$ is one-to-one.
This means it is single-rooted, i.e. for all $x \in \ran{F}$, there exists
exactly one $t$ such that $\pair{t, x} \in F$.
By definition of the \nameref{ref:inverse} of $F$,
$\pair{x, t} \in F^{-1}$.
But then for all $x \in \dom{(F^{-1})}$, there exists exactly one $t$ such
that $\pair{x, t} \in F^{-1}$.
Thus $F^{-1}$ is a function.
\paragraph{(ii)}%
\hyperlabel{par:lemma-1-ii}
By hypothesis, $F$ is single-valued.
That is, for all $x \in \dom{F}$, there exists exactly one $y$ such that
$\pair{x, y} \in F$.
By definition of the \nameref{ref:inverse} of $F$,
$\pair{y, x} \in F^{-1}$.
But then for all $x \in \ran{(F^{-1})}$, there exists exactly one $y$ such
that $\pair{y, x} \in F^{-1}$.
Thus $F^{-1}$ is single-rooted.
\paragraph{Conclusion}%
By \nameref{par:lemma-1-i} and \nameref{par:lemma-1-ii}, $F^{-1}$ is
a one-to-one function.
\end{proof}
\subsection{\verified{Theorem 3G}}%
\hyperlabel{sub:theorem-3g}
\begin{theorem}[3G]
Assume that $F$ is a one-to-one function.
If $x \in \dom{F}$, then $F^{-1}(F(x)) = x$.
If $y \in \ran{F}$, then $F(F^{-1}(y)) = y$.
\end{theorem}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3g\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3g\_ii}
Suppose $F$ is a one-to-one \nameref{ref:function}.
Then \nameref{sub:lemma-1} indicates $F^{-1}$ is a one-to-one function with
domain $\ran{F}$ and range $\dom{F}$.
For all $x \in \dom{F}$, $\pair{x, F(x)} \in F$.
Then $\pair{F(x), x} \in F^{-1}$.
Since $F^{-1}$ is single-valued, $F^{-1}(F(x)) = x$.
For all $y \in \ran{F}$, $\pair{y, F^{-1}(y)} \in F^{-1}$.
Then $\pair{F^{-1}(y), y} \in F$.
Since $F$ is single-valued, $F(F^{-1}(y)) = y$.
\end{proof}
\subsection{\verified{Theorem 3H}}%
\hyperlabel{sub:theorem-3h}
\begin{theorem}[3H]
Assume that $F$ and $G$ are functions.
Then $F \circ G$ is a function, its domain is
\begin{equation}
\hyperlabel{sub:theorem-3h-eq1}
\{x \in \dom{G} \mid G(x) \in \dom{F}\},
\end{equation}
and for $x$ in its domain, $(F \circ G)(x) = F(G(x))$.
\end{theorem}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Relation}
{Set.Relation.single\_valued\_comp\_is\_single\_valued}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3h\_dom}
Let $F$ and $G$ be \nameref{ref:function}s.
By definition of the \nameref{ref:composition} of $F$ and $G$,
\begin{equation}
\hyperlabel{sub:theorem-3h-eq2}
F \circ G = \{\pair{u, v} \mid \exists t(uGt \land tFv)\}.
\end{equation}
By construction, $F \circ G$ is a relation.
By the definition of the \nameref{ref:domain} of a relation,
$x \in \dom{(F \circ G)}$ if and only if there exists some $y$ such that
$\pair{x, y} \in F \circ G$.
We prove that (i) $F \circ G$ is a function with domain satisfying
\eqref{sub:theorem-3h-eq1}, and (ii) $(F \circ G)(x) = F(G(x))$.
\paragraph{(i)}%
\hyperlabel{par:theorem-3h-i}
By \eqref{sub:theorem-3h-eq2}, there exists some $t$ such that
$\pair{x, t} \in G$ and $\pair{t, y} \in F$.
Since $G$ is single-valued, $t$ is uniquely determined by $x$.
Since $F$ is single-valued, $y$ is uniquely determined by $t$.
Therefore, by transitivity, $y$ is uniquely determined by $x$.
Thus $F \circ G$ is single-valued, i.e. $F \circ G$ is a function.
Furthermore, by definition of function application, $t = G(x)$.
Thus $$\pair{x, G(x)} \in G \quad\text{and}\quad \pair{G(x), y} \in F.$$
This immediately implies \eqref{sub:theorem-3h-eq1} holds true.
\paragraph{(ii)}%
Let $x \in \dom{(F \circ G)}$.
By definition, $\pair{x, (F \circ G)(x)} \in F \circ G$.
Then \eqref{sub:theorem-3h-eq2} implies $(F \circ G)(x)$ satisfies
$\pair{G(x), (F \circ G)(x)} \in F$.
This is equivalent to saying $F(G(x)) = (F \circ G)(x)$ as expected.
\end{proof}
\subsection{\verified{Theorem 3I}}%
\hyperlabel{sub:theorem-3i}
\begin{theorem}[3I]
For any sets $F$ and $G$, $$(F \circ G)^{-1} = G^{-1} \circ F^{-1}.$$
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Relation}
{Set.Relation.comp\_inv\_eq\_inv\_comp\_inv}
By definition of the \nameref{ref:composition} of $F$ and $G$,
$$F \circ G = \{\pair{u, v} \mid \exists t(uGt \land tFv)\}.$$
By definition of the \nameref{ref:inverse} of a function,
\begin{align*}
(F \circ G)^{-1}
& = \{\pair{u, v} \mid \exists t (vGt \land tFu)\} \\
& = \{\pair{u, v} \mid \exists t (tFu \land vGt)\} \\
& = \{\pair{u, v} \mid
\exists t \left[ u(F^{-1})t \land t(G^{-1})v \right]\} \\
& = G^{-1} \circ F^{-1}.
\end{align*}
\end{proof}
\subsection{\pending{Theorem 3J}}%
\hyperlabel{sub:theorem-3j}
\begin{theorem}[3J]
Assume that $F \colon A \rightarrow B$, and that $A$ is nonempty.
\begin{enumerate}[(a)]
\item There exists a function $G \colon B \rightarrow A$ (a "left inverse")
such that $G \circ F$ is the identity function $I_A$ on $A$ iff $F$ is
one-to-one.
\item There exists a function $H \colon B \rightarrow A$ (a "right inverse")
such that $F \circ H$ is the identity function $I_B$ on $B$ iff $F$ maps
$A$ \textit{onto} $B$.
\end{enumerate}
\end{theorem}
\begin{proof}
Let $F$ be a \nameref{ref:function} from nonempty set $A$ to set $B$.
\paragraph{(a)}%
We prove there exists a function $G \colon B \rightarrow A$ such that
$G \circ F = I_A$ if and only if $F$ is one-to-one.
\subparagraph{($\Rightarrow$)}%
Let $G \colon B \rightarrow A$ such that $G \circ F = I_A$.
All that remains is to prove $F$ is single-rooted.
Let $y \in \ran{F}$.
By definition of the \nameref{ref:range} of a function, there exists some
$x_1$ such that $\pair{x_1, y} \in F$.
Suppose there exists a set $x_2$ such that $\pair{x_2, y} \in F$.
By hypothesis, $G(F(x_1)) = G(F(x_2))$ implies $I_A(x_1) = I_A(x_2)$.
Thus $x_1 = x_2$.
Therefore $F$ must be single-rooted.
\subparagraph{($\Leftarrow$)}%
Let $F$ be one-to-one.
Since $A$ is nonempty, there exists some $a \in A$.
Let $G \colon B \rightarrow A$ be given by
$$G(y) = \begin{cases}
F^{-1}(y) & \text{if } y \in \ran{F} \\
a & \text{otherwise}.
\end{cases}$$
$G$ is a function by virtue of \nameref{sub:lemma-1} and choice of mapping
for all values $y \not\in \ran{F}$.
Furthermore, for all $x \in A$, $F(x) \in \ran{F}$.
Thus $(G \circ F)(x) = G(F(x)) = F^{-1}(F(x)) = x$ by
\nameref{sub:theorem-3g}.
\paragraph{(b)}%
We prove there exists a function $H \colon B \rightarrow A$ such that
$F \circ H = I_A$ if and only if $F$ maps $A$ onto $B$.
\subparagraph{($\Rightarrow$)}%
Suppose $H \colon B \rightarrow A$ such that $F \circ H = I_A$.
All that remains is to prove $\ran{F} = B$.
Note that $\ran{F} \subseteq B$ by hypothesis.
Let $y \in B$.
But $F(H(y)) = y$ meaning $y \in \ran{F}$.
Thus $B \subseteq \ran{F}$.
Since $\ran{F} \subseteq B$ and $B \subseteq \ran{F}$, $\ran{F} = B$.
\subparagraph{($\Leftarrow$)}%
Suppose $F$ maps $A$ \textit{onto} $B$.
By definition of maps onto, $\ran{F} = B$.
Then for all $y \in B$, there exists some $x \in A$ such that
$\pair{x, y} \in F$.
Notice though that $F^{-1}[\{y\}]$ may not be a singleton set.
Then there is no obvious way to \textit{choose} an element from each
preimage to form a function.
By the \nameref{ref:axiom-of-choice-1}, there exists a function
$H \subseteq F^{-1}$ such that $\dom{H} = \dom{F^{-1}} = B$.
For all $y \in B$, $\pair{y, H(y)} \in H \subseteq F^{-1}$
meaning $\pair{H(y), y} \in F$.
Thus $F(H(y)) = y$ as expected.
\end{proof}
\subsection{\verified{Theorem 3K(a)}}%
\hyperlabel{sub:theorem-3k-a}
\begin{theorem}[3K(a)]
The following hold for any sets. ($F$ need not be a function.)
The image of a union is the union of the images:
\begin{equation}
\hyperlabel{sub:theorem-3k-a-eq1}
\img{F}{A \cup B} = \img{F}{A} \cup \img{F}{B}
\end{equation}
and
\begin{equation}
\hyperlabel{sub:theorem-3k-a-eq2}
\img{F}{\bigcup{\mathscr{A}}} =
\bigcup\;\{\img{F}{A} \mid A \in \mathscr{A}\}.
\end{equation}
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3k\_a}
Let $F$, $A$, $B$, and $\mathscr{A}$ be arbitrary sets.
We prove (i) \eqref{sub:theorem-3k-a-eq1} and (ii)
\eqref{sub:theorem-3k-a-eq2}.
\paragraph{(i)}%
By definition of the \nameref{ref:image} of a set:
\begin{align*}
\img{F}{A \cup B}
& = \{v \mid \exists u, u \in A \cup B \land uFv\} \\
& = \{v \mid \exists u,
(u \in A \land uFv) \lor (u \in B \land uFv)\} \\
& = \{v \mid (\exists u \in A) uFv\} \cup
\{v \mid (\exists u \in B) uFv\} \\
& = \img{F}{A} \cup \img{F}{B}.
\end{align*}
\paragraph{(ii)}%
We prove that both sides of \eqref{sub:theorem-3k-a-eq2} is a subset of the
other.
\subparagraph{($\subseteq$)}%
Let $v \in \img{F}{\bigcup{\mathscr{A}}}$.
By definition of the \nameref{ref:image} of a set, there exists a set $u$
such that $u \in \bigcup{\mathscr{A}} \land uFv$.
Then, by definition of the union of sets, there exists some
$A \in \mathscr{A}$ such that $u \in A$.
Therefore $v \in \img{F}{A}$ meaning
$v \in \bigcup\{\img{F}{A} \mid A \in \mathscr{A}\}$.
\subparagraph{($\supseteq$)}%
Let $v \in \bigcup\{\img{F}{A} \mid A \in \mathscr{A}\}$.
Then there exists some $b \in \{\img{F}{A} \mid A \in \mathscr{A}\}$ such
that $v \in b$.
In other words, there exists some $A \in \mathscr{A}$ such that
$v \in b = \img{F}{A}$.
By definition of the \nameref{ref:image} of a set, there exists a set $u$
such that $u \in A \land uFv$.
But this implies that $u \in \bigcup{\mathscr{A}} \land uFv$.
Therefore $v \in \img{F}{\bigcup{\mathscr{A}}}$.
\end{proof}
\subsection{\verified{Theorem 3K(b)}}%
\hyperlabel{sub:theorem-3k-b}
\begin{theorem}[3K(b)]
The following hold for any sets. ($F$ need not be a function.)
The image of an intersection is included in the intersection of the images:
\begin{equation}
\hyperlabel{sub:theorem-3k-b-eq1}
\img{F}{A \cap B} \subseteq \img{F}{A} \cap \img{F}{B}
\end{equation}
and
\begin{equation}
\hyperlabel{sub:theorem-3k-b-eq2}
\img{F}{\bigcap\mathscr{A}} \subseteq
\bigcap\;\{\img{F}{A} \mid A \in \mathscr{A}\}.
\end{equation}
for nonempty $\mathscr{A}$.
Equality holds if $F$ is single-rooted.
\end{theorem}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3k\_b\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3k\_b\_ii}
Let $F$, $A$, $B$ be arbitrary sets.
Let $\mathscr{A}$ be a nonempty set.
We first prove (i) \eqref{sub:theorem-3k-b-eq1} and (ii)
\eqref{sub:theorem-3k-b-eq2}.
Then, assuming $F$ is single-rooted, we prove both (iii)
\eqref{sub:theorem-3k-b-eq1} and (iv) \eqref{sub:theorem-3k-b-eq2} hold
under equality.
\paragraph{(i)}%
\hyperlabel{par:theorem-3k-b-i}
Let $v \in \img{F}{A \cap B}$.
By definition of the \nameref{ref:image} of a set,
$\exists u \in A \cap B, uFv$.
Then $u \in A \land uFv$ and $u \in B \land uFv$.
Therefore $v \in \img{F}{A} \cap \img{F}{B}$.
\paragraph{(ii)}%
\hyperlabel{par:theorem-3k-b-ii}
Let $v \in \img{F}{\bigcap{\mathscr{A}}}$.
By definition of the \nameref{ref:image} of a set,
$\exists u \in \bigcap{\mathscr{A}}, uFv$.
Then $\exists u, (\forall A \in \mathscr{A}, u \in A) \land uFv$.
This implies that $\forall A \in \mathscr{A}, \exists u \in A, uFv$.
Then $\forall A \in \mathscr{A}, v \in \img{F}{A}$.
Thus $v \in \bigcap\{\img{F}{A} \mid A \in \mathscr{A}\}$.
\paragraph{(iii)}%
Suppose $F$ is single-rooted.
By \nameref{par:theorem-3k-b-i},
$$\img{F}{A \cap B} \subseteq \img{F}{A} \cap \img{F}{B}.$$
All that remains is showing
$$\img{F}{A} \cap \img{F}{B} \subseteq \img{F}{A \cap B}.$$
Let $v \in \img{F}{A} \cap \img{F}{B}$.
Then $v \in \img{F}{A}$ and $v \in \img{F}{B}$.
That is, $\exists u \in A, uFv$ and $\exists w \in B, wFv$.
Since $F$ is single rooted, it follows $u = w$.
Thus $u \in A \cap B \land uFv$ meaning $v \in \img{F}{A \cap B}$.
\paragraph{(iv)}%
Suppose $F$ is single-rooted.
By \nameref{par:theorem-3k-b-ii},
$$\img{F}{\bigcap\mathscr{A}} \subseteq
\bigcap\;\{\img{F}{A} \mid A \in \mathscr{A}\}.$$
All that remains is showing
$$\bigcap\;\{\img{F}{A} \mid A \in \mathscr{A}\} \subseteq
\img{F}{\bigcap\mathscr{A}}.$$
Let $v \in \bigcap\;\{\img{F}{A} \mid A \in \mathscr{A}\}$.
Then $\forall A \in \mathscr{A}, v \in \img{F}{A}$.
By definition of the \nameref{ref:image} of a set,
$\forall A \in \mathscr{A}, \exists u \in A, uFv$.
Since $F$ is single-rooted and $\mathscr{A}$ is nonempty, it follows that
$\exists u, (\forall A \in \mathscr{A}, u \in A) \land uFv$.
Equivalently, $\exists u \in \bigcap{A}, uFv$.
Thus $v \in \img{F}{\bigcap{A}}$.
\end{proof}
\subsection{\verified{Theorem 3K(c)}}%
\hyperlabel{sub:theorem-3k-c}
\begin{theorem}[3K(c)]
The following hold for any sets. ($F$ need not be a function.)
The image of a difference includes the difference of the images:
\begin{equation}
\hyperlabel{sub:theorem-3k-c-eq1}
\img{F}{A} - \img{F}{B} \subseteq \img{F}{A - B}.
\end{equation}
Equality holds if $F$ is single-rooted.
\end{theorem}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3k\_c\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3k\_c\_ii}
We prove that (i) \eqref{sub:theorem-3k-c-eq1} holds and (ii) equality holds
if $F$ is single-rooted.
\paragraph{(i)}%
\hyperlabel{par:theorem-3k-c-i}
Let $v \in \img{F}{A} - \img{F}{B}$.
By definition of the difference of two sets,
$v \in \img{F}{A}$ and $v \not\in \img{F}{B}$.
By definition of the \nameref{ref:image} of a set, there exists a set
$u \in A$ such that $\pair{u, v} \in F$.
Likewise, $\forall w \in B, \pair{w, v} \not\in F$.
Thus $u \not\in B$, since otherwise we get an immediate contradiction.
Therefore $u \in A - B$ meaning $v \in \img{F}{A - B}$.
\paragraph{(ii)}%
Suppose $F$ is single-rooted.
By \nameref{par:theorem-3k-c-i},
$$\img{F}{A} - \img{F}{B} \subseteq \img{F}{A - B}.$$
All that remains is showing
$$\img{F}{A - B} \subseteq \img{F}{A} - \img{F}{B}.$$
Let $v \in \img{F}{A - B}$.
By definition of the \nameref{ref:image} of a set, there exists a set
$u \in A - B$ such that $uFv$.
Then $u \in A$ and $u \not\in B$.
The former membership relation implies $v \in \img{F}{A}$.
The latter implies $v \not\in \img{F}{B}$ since $F$ being single-rooted
would otherwise invoke an immediate contradiction.
Thus $v \in \img{F}{A} - \img{F}{B}$.
\end{proof}
\subsection{\verified{Corollary 3L}}%
\hyperlabel{sub:corollary-3l}
\begin{theorem}[3L]
For any function $G$ and sets $A$, $B$, and $\mathscr{A}$:
\begin{align}
\img{G^{-1}}{\bigcup{\mathscr{A}}}
& = \bigcup\;\{\img{G^{-1}}{A} \mid A \in \mathscr{A}\},
\hyperlabel{sub:corollary-3l-eq1} \\
\img{G^{-1}}{\bigcap{\mathscr{A}}}
& = \bigcap\;\{\img{G^{-1}}{A} \mid A \in \mathscr{A}\}
\text{ for } \mathscr{A} \neq \emptyset,
\hyperlabel{sub:corollary-3l-eq2} \\
\img{G^{-1}}{A - B} & = \img{G^{-1}}{A} - \img{G^{-1}}{B}.
\hyperlabel{sub:corollary-3l-eq3}
\end{align}
\end{theorem}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.corollary\_3l\_i}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.corollary\_3l\_ii}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.corollary\_3l\_iii}
\nameref{sub:theorem-3k-a} implies \eqref{sub:corollary-3l-eq1}.
Because the inverse of a function is always single-rooted,
\nameref{sub:theorem-3k-b} implies \eqref{sub:corollary-3l-eq2}.
Likewise \nameref{sub:theorem-3k-c} implies \eqref{sub:corollary-3l-eq3}.
\end{proof}
\section{Equivalence Relations}%
\hyperlabel{sec:equivalence-relations}
\subsection{\verified{Theorem 3M}}%
\hyperlabel{sub:theorem-3m}
\begin{theorem}[3M]
If $R$ is a symmetric and transitive relation, then $R$ is an equivalence
relation on $\fld{R}$.
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3m}
Suppose $R$ is a \nameref{ref:symmetric} and \nameref{ref:transitive}
\nameref{ref:relation}.
By definition, the \nameref{ref:field} of $R$ is given by
$\fld{R} = \dom{R} \cup \ran{R}$.
An \nameref{ref:equivalence-relation} on $\fld{R}$ is, by definition, a
binary relation \nameref{ref:reflexive} on $\fld{R}$, symmetric, and
transitive.
All that remains is to show $R$ is reflexive on $\fld{R}$.
Let $x \in \fld{R}$.
Then $x \in \dom{R}$ or $x \in \ran{R}$.
If $x \in \dom{R}$, there exists some $y$ such that $xRy$.
Since $R$ is symmetric, it follows $yRx$.
Since $R$ is transitive, it follows $xRx$.
If instead $x \in \ran{R}$, there exists some $t$ such that $tRx$.
Since $R$ is symmetric, it follows $xRt$.
Since $R$ is transitive, it follows $xRx$.
Thus $R$ is reflexive on $\fld{R}$.
\end{proof}
\subsection{\verified{Lemma 3N}}%
\hyperlabel{sub:lemma-3n}
\begin{lemma}[3N]
Assume that $R$ is an equivalence relation on $A$ and that $x$ and $y$ belong
to $A$.
Then $$[x]_R = [y]_R \iff xRy.$$
\end{lemma}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Relation}
{Set.Relation.neighborhood\_iff\_mem}
Suppose $R$ is an \nameref{ref:equivalence-relation} on set $A$.
Let $x, y \in A$.
\paragraph{($\Rightarrow$)}%
Suppose $[x]_R = [y]_R$.
Since $R$ is an equivalence relation, it is reflexive on $A$.
Thus $yRy$ meaning $y \in [y]_R = \{t \mid yRt\}$.
Since $[x]_R = [y]_R$, $y \in \{t \mid xRt\}$ as well.
That is, $xRy$.
\paragraph{($\Leftarrow$)}%
Suppose $xRy$.
We show $[x]_R \subseteq [y]_R$ and $[y]_R \subseteq [x]_R$.
\subparagraph{($\subseteq$)}%
Let $t \in [x]_R$.
Then $xRt$.
Since $R$ is symmetric, $xRy$ implies $yRx$.
Since $R$ is transitive, $yRx$ and $xRt$ implies $yRt$.
Thus $t \in [y]_R$.
\subparagraph{($\supseteq$)}%
Let $t \in [y]_R$.
Then $yRt$.
Since $R$ is transitive, $xRy$ and $yRt$ implies $xRt$.
Thus $t \in [x]_R$.
\end{proof}
\subsection{\verified{Theorem 3P}}%
\hyperlabel{sub:theorem-3p}
\begin{theorem}[3P]
Assume that $R$ is an equivalence relation on $A$.
Then the set $\{[x]_R \mid x \in A\}$ of all equivalence classes is a
partition of $A$.
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Relation}{Set.Relation.modEquiv\_partition}
Let $\Pi = \{[x]_R \mid x \in A\}$.
We show that (i) there are no empty sets in $\Pi$, (ii) no two different sets
in $\Pi$ have any common elements and (iii) that each element of $A$ is in
some set in $\Pi$.
\paragraph{(i)}%
By construction, every element of $\Pi$ is of form $[x]_R$ for some
$x \in A$.
At the very least, $x \in A$ is also in $[x]_R$.
Thus every element of $\Pi$ must be nonempty.
\paragraph{(ii)}%
Let $[x]_R, [y]_R \in \Pi$ be two different sets.
We must show that $[x]_R \cap [y]_R = \emptyset$.
For the sake of contradiction, suppose $[x]_R \cap [y]_R \neq \emptyset$.
Let $z \in [x]_R \cap [y]_R$.
Then $xRz$ and $yRz$.
Since $R$ is an \nameref{ref:equivalence-relation} on $A$, it is
\nameref{ref:symmetric} and \nameref{ref:transitive}.
Then $zRy$ and $xRy$.
By \nameref{sub:lemma-3n}, $xRy$ if and only if $[x]_R = [y]_R$,
contradicting the distinctness of $[x]_R$ and $[y]_R$.
Thus it follows $[x]_R \cap [y]_R] = \emptyset$.
\paragraph{(iii)}%
Let $x \in A$.
Since $R$ is an \nameref{ref:equivalence-relation} on $A$, it follows
$xRx$.
Thus $x$ is a member of some set in $\Pi$, namely $[x]_R$.
\end{proof}
\subsection{\unverified{Theorem 3Q}}%
\hyperlabel{sub:theorem-3q}
\begin{theorem}[3Q]
Assume that $R$ is an equivalence relation on $A$ and that
$F \colon A \rightarrow A$.
If $F$ is compatible with $R$, then there exists a unique
$\hat{F} \colon A / R \rightarrow A / R$ such that
\begin{equation}
\hyperlabel{sub:theorem-3q-eq1}
\hat{F}([x]_R) = [F(x)]_R \quad\text{for all } x \text{ in } A.
\end{equation}
If $F$ is not compatible with $R$, then no such $\hat{F}$ exists.
\end{theorem}
\begin{proof}
Let $R$ be an \nameref{ref:equivalence-relation} on $A$ and
$F \colon A \rightarrow A$.
Suppose $F$ is \nameref{ref:compatible} with $R$.
Next define \nameref{ref:relation} $\hat{F}$ to be
$$\hat{F} = \{\pair{[x]_R, [F(x)]_R} \mid x \in A\}.$$
By construction $\hat{F}$ has domain $A / R$ and
$\ran{\hat{F}} \subseteq A / R$.
All that remains is proving $\hat{F}$ is single-valued.
Let $[x_1]_R, [x_2]_R \in \dom{\hat{F}}$ such that $[x_1]_R = [x_2]_R$.
By definition of $\hat{F}$, $\pair{[x_1]_R, [F(x_1)]_R} \in \hat{F}$
and $\pair{[x_2]_R, [F(x_2)]_R} \in \hat{F}$.
By \nameref{sub:lemma-3n}, $[x_1]_R = [x_2]_R$ implies $x_1Rx_2$.
Since $F$ is compatible, $F(x_1)RF(x_2)$.
Another application of \nameref{sub:lemma-3n} implies that
$[F(x_1)]_R = [F(x_2)]_R$.
Thus $\hat{F}$ is single-valued.
Uniqueness follows immediately from the \nameref{ref:extensionality-axiom}.
\suitdivider
Suppose $F$ is not compatible with $R$.
Then there exists some $x, y \in A$ such that $xRy$ and $\neg F(x)RF(y)$.
By \nameref{sub:lemma-3n}, $[x]_R = [y]_R$.
For the sake of contradiction, suppose a function $\hat{F}$ exists satisfying
\eqref{sub:theorem-3q-eq1}.
Then $\hat{F}([x]_R) = \hat{F}([y]_R)$ meaning $[F(x)]_R = [F(y)]_R$.
Then \nameref{sub:lemma-3n} implies $F(x)RF(y)$, a contradiction.
Therefore our original hypothesis must be incorrect.
That is, there is no function $\hat{F}$ satisfying \eqref{sub:theorem-3q-eq1}.
\end{proof}
\section{Ordering Relations}%
\hyperlabel{sec:ordering-relations}
\subsection{\verified{Theorem 3R}}%
\hyperlabel{sub:theorem-3r}
\begin{theorem}[3R]
Let $R$ be a linear ordering on $A$.
\begin{enumerate}[(i)]
\item There is no $x$ for which $xRx$.
\item For distinct $x$ and $y$ in $A$, either $xRy$ or $yRx$.
\end{enumerate}
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.theorem\_3r}
Suppose $R$ is a \nameref{ref:linear-ordering} on $A$.
\paragraph{(i)}%
Let $x \in A$.
By definition, $R$ is \nameref{ref:trichotomous}.
Then only one of $xRx$ and $x = x$ can hold.
Since $x = x$ obviously holds, it follows $\pair{x, x} \not\in R$.
\paragraph{(ii)}%
Let $x, y \in A$ such that $x \neq y$.
By definition, $R$ is \nameref{ref:trichotomous}.
Thus only one of $$xRy, \quad x = y, \quad yRx$$ hold.
By hypothesis $x \neq y$ meaning either $xRy$ or $yRx$.
\end{proof}
\section{Exercises 3}%
\hyperlabel{sec:exercises-3}
\subsection{\verified{Exercise 3.1}}%
\hyperlabel{sub:exercise-3.1}
Suppose that we attempted to generalize the Kuratowski definitions of ordered
pairs to ordered triples by defining
$$\pair{x, y, z}^* = \{\{x\}, \{x, y\}, \{x, y, z\}\}.$$
Show that this definition is unsuccessful by giving examples of objects
$u$, $v$, $w$, $x$, $y$, $z$ with
$\pair{x, y, z}^* = \pair{u, v, w}^*$ but with either
$y \neq v$ or $z \neq w$ (or both).
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_1}
Let $x = 1$, $y = 1$, and $z = 2$.
Let $u = 1$, $v = 2$, and $w = 2$.
Then
\begin{align*}
\pair{x, y, z}^*
& = \{\{x\}, \{x, y\}, \{x, y, z\}\} \\
& = \{\{1\}, \{1, 1\}, \{1, 1, 2\}\} \\
& = \{\{1\}, \{1, 2\}\}.
\end{align*}
Likewise
\begin{align*}
\pair{u, v, w}^*
& = \{\{u\}, \{u, v\}, \{u, v, w\}\} \\
& = \{\{1\}, \{1, 2\}, \{1, 2, 2\}\} \\
& = \{\{1\}, \{1, 2\}\}.
\end{align*}
Thus $\pair{x, y, z}^* = \pair{u, v, w}^*$ but $y \neq v$.
\end{proof}
\subsection{\verified{Exercise 3.2a}}%
\hyperlabel{sub:exercise-3.2a}
Show that $A \times (B \cup C) = (A \times B) \cup (A \times C)$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_2a}
Let $A$, $B$, and $C$ be arbitrary sets.
Then by \nameref{sub:corollary-3c} and the definition of the union of sets,
\begin{align*}
A \times (B \cup C)
& = \{ \pair{x, y} \mid x \in A \land y \in (B \cup C) \} \\
& = \{ \pair{x, y} \mid
x \in A \land (y \in B \lor y \in C) \} \\
& = \{ \pair{x, y} \mid
(x \in A \land y \in B) \lor (x \in A \land y \in C) \} \\
& = \{ \pair{x, y} \mid (x \in A \land y \in B) \} \cup
\{ \pair{x, y} \mid (x \in A \land y \in C) \} \\
& = (A \times B) \cup (A \times C).
\end{align*}
\end{proof}
\subsection{\verified{Exercise 3.2b}}%
\hyperlabel{sub:exercise-3.2b}
Show that if $A \times B = A \times C$ and $A \neq \emptyset$, then $B = C$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_2b}
Let $A$, $B$, and $C$ be arbitrary sets such that $A \neq \emptyset$.
By \nameref{sub:corollary-3c},
\begin{align}
A \times B & = \{ \pair{x, y} \mid x \in A \land y \in B \}
& \hyperlabel{sub:exercise-3.2b-eq1} \\
A \times C & = \{ \pair{x, y} \mid x \in A \land y \in C \}.
& \hyperlabel{sub:exercise-3.2b-eq2}
\end{align}
There are two cases to consider:
\paragraph{Case 1}%
Suppose $B \neq \emptyset$.
Then $A \times B \neq \emptyset$ and $A \times C \neq \emptyset$.
Let $\pair{x, y} \in A \times B$.
By \eqref{sub:exercise-3.2b-eq1}, $x \in A$ and $y \in B$.
By the \nameref{ref:extensionality-axiom},
$$\pair{x, y} \in A \times B \iff \pair{x, y} \in A \times C.$$
Therefore $\pair{x, y} \in A \times C$.
By \eqref{sub:exercise-3.2b-eq2}, $x \in A$ and $y \in C$.
Since membership of $y$ in $B$ and in $C$ holds biconditionally, the
\nameref{ref:extensionality-axiom} indicates $B = C$.
\paragraph{Case 2}%
Suppose $B = \emptyset$.
Then there is no $\pair{x, y}$ such that $x \in A$ and $y \in B$.
Thus $A \times B = \emptyset$ and $A \times C = \emptyset$.
But then there cannot exist an $\pair{x, y}$ such that $x \in A$
and $y \in C$ either.
Since $A \neq \emptyset$, it must be the case that $C = \emptyset$.
Thus $B = C$.
\end{proof}
\subsection{\verified{Exercise 3.3}}%
\hyperlabel{sub:exercise-3.3}
Show that $A \times \bigcup \mathscr{B} =
\bigcup\;\{ A \times X \mid X \in \mathscr{B} \}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_3}
Let $A$ and $\mathscr{B}$ be arbitrary sets.
By \nameref{sub:corollary-3c} and the definition of the union of sets,
\begin{align*}
A \times \bigcup\mathscr{B}
& = \{ \pair{x, y} \mid
x \in A \land y \in \bigcup\mathscr{B} \} \\
& = \{ \pair{x, y} \mid
x \in A \land (\exists b \in \mathscr{B}), y \in b \} \\
& = \{ \pair{x, y} \mid
(\exists b \in \mathscr{B}), x \in A \land y \in b \} \\
& = \bigcup\; \{ A \times X \mid X \in \mathscr{B} \}.
\end{align*}
\end{proof}
\subsection{\unverified{Exercise 3.4}}%
\hyperlabel{sub:exercise-3.4}
Show that there is no set to which every ordered pair belongs.
\begin{proof}
For the sake of contradiction, suppose there exists a set $A$ to which every
ordered pair belongs.
That is, for all sets $x$ and $y$, $\pair{x, y} = \{\{x\}, \{x, y\}\}$
is a member of $A$.
By the \nameref{ref:union-axiom}, it follows that $\bigcup\bigcup A$ is the
set to which every set belongs.
But \nameref{sub:theorem-2a} shows this is impossible.
Thus our original assumption was wrong; there exists no set to which every
ordered pair belongs.
\end{proof}
\subsection{\verified{Exercise 3.5a}}%
\hyperlabel{sub:exercise-3.5a}
Assume that $A$ and $B$ are given sets, and show that there exists a set $C$
such that for any $y$,
\begin{equation}
\hyperlabel{sub:exercise-3.5a-eq1}
y \in C \iff y = \{x\} \times B \text{ for some } x \text{ in } A.
\end{equation}
In other words, show that $\{\{x\} \times B \mid x \in A\}$ is a set.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_5a}
Let $a \in A$.
By the \nameref{ref:pairing-axiom}, $\{a\}$ is a set.
By \nameref{sub:corollary-3c}, $\{a\} \times B$ is a set.
Again by the \nameref{ref:pairing-axiom}, $\{\{a\} \times B\}$ is a set.
Next, by another application of \nameref{sub:corollary-3c}, $A \times B$
is a set.
By the \nameref{ref:power-set-axiom}, $\powerset{(A \times B)}$ is a set.
Thus, by the \nameref{ref:subset-axioms}, the following is also a set:
$$C = \{ y \in \powerset{(A \times B)} \mid
\exists a \in A, \forall x, \left[ x \in y \iff
\exists b \in B, x = \pair{a, b} \right] \}.$$
We now show that $C$ satisfies \eqref{sub:exercise-3.5a-eq1}.
\paragraph{($\Rightarrow$)}%
Suppose $y \in C$.
Then there exists some $a \in A$ such that
$$\forall x, \left[ x \in y \iff
\exists b \in B, x = \pair{a, b} \right].$$
By the \nameref{ref:extensionality-axiom},
\begin{align*}
y
& = \{ \pair{a, b} \mid b \in B \} \\
& = \{ \pair{x, b} \mid x \in \{a\} \land b \in B \} \\
& = \{ \{a\} \times B \}.
\end{align*}
\paragraph{($\Leftarrow$)}%
Suppose $y = \{a\} \times B$ for some $a \in A$.
By \nameref{sub:corollary-3c}, $x \in \{a\} \times B$ if and only if
$\exists b \in B$ such that $x = \pair{a, b}$.
But then $x \in y$ if and only if $\exists b \in B$ such that
$x = \pair{a, b}$.
This immediately proves $y \in C$.
\end{proof}
\subsection{\verified{Exercise 3.5b}}%
\hyperlabel{sub:exercise-3.5b}
With $A$, $B$, and $C$ as above, show that $A \times B = \bigcup C$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_5b}
Let $A$ and $B$ be arbitrary sets.
We want to show that
\begin{equation}
\hyperlabel{sub:exercise-3.5b-eq1}
A \times B = \bigcup\; \{\{x\} \times B \mid x \in A\}.
\end{equation}
The left-hand side of \eqref{sub:exercise-3.5b-eq1} is a set by virtue of
\nameref{sub:corollary-3c}.
The right-hand side of \eqref{sub:exercise-3.5b-eq1} is a set by virtue of
\nameref{sub:exercise-3.5a}.
We prove the set on each side is a subset of the other.
\paragraph{($\subseteq$)}%
Let $c \in A \times B$.
Then there exists some $a \in A$ and $b \in B$ such that $c = \pair{a, b}$.
Thus $c \in \{a\} \times B$.
We also note $\{a\} \times B \in \{\{x\} \times B \mid x \in A\}$,
specifically when $x = a$.
Therefore, by the \nameref{ref:union-axiom},
$c \in \bigcup\;\{\{x\} \times B \mid x \in A\}$.
\paragraph{($\supseteq$)}%
Let $c \in \bigcup\; \{\{x\} \times B \mid x \in A\}$.
By the \nameref{ref:union-axiom}, there exists some
$b \in \{\{x\} \times B \mid x \in A\}$ such that $c \in b$.
Then there exists some $x \in A$ such that $b = \{x\} \times B$.
Therefore $c \in \{x\} \times B$.
But $x \in A$ meaning $c \in A \times B$ as well.
\paragraph{Conclusion}%
Since we have shown
$A \times B \subseteq \bigcup\; \{\{x\} \times B \mid x \in A\}$ and
$A \times B \supseteq \bigcup\; \{\{x\} \times B \mid x \in A\}$, it
follows \eqref{sub:exercise-3.5b-eq1} is a true identity.
\end{proof}
\subsection{\verified{Exercise 3.6}}%
\hyperlabel{sub:exercise-3.6}
Show that a set $A$ is a relation iff $A \subseteq \dom{A} \times \ran{A}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_6}
Let $A$ be a set.
We prove the forward and reverse direction of the bidirectional.
\paragraph{($\Rightarrow$)}%
Suppose $A$ is a \nameref{ref:relation}.
We show for all $a \in A$, $a \in \dom{A} \times \ran{A}$.
Let $a \in A$.
Since $A$ is a relation, $a$ is an ordered pair.
Then there exists some sets $x$ and $y$ such that $a = \pair{x, y}$.
By the definition of the \nameref{ref:domain} and \nameref{ref:range} of
$A$, $x \in \dom{A}$ and $y \in \ran{A}$.
Thus $a = \pair{x, y} \in \dom{A} \times \ran{A}$ as well.
This proves $A \subseteq \dom{A} \times \ran{A}$.
\paragraph{($\Leftarrow$)}%
Suppose $A \subseteq \dom{A} \times \ran{A}$.
Then for all $a \in A$, $a \in \dom{A} \times \ran{A}$.
Therefore $a$ is an ordered pair.
Since this holds for all $a \in A$, it follows $A$ is a relation.
\end{proof}
\subsection{\verified{Exercise 3.7}}%
\hyperlabel{sub:exercise-3.7}
Show that if $R$ is a relation, then $\fld{R} = \bigcup\bigcup R$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_7}
Let $R$ be a \nameref{ref:relation}.
We show that (i) $\fld{R} \subseteq \bigcup\bigcup R$ and (ii) that
$\bigcup\bigcup R \subseteq \fld{R}$.
\paragraph{(i)}%
\hyperlabel{par:exercise-3.7-i}
Let $x \in \fld{R} = \dom{R} \cup \ran{R}$.
That is, $x \in \dom{R}$ or $x \in \ran{R}$.
If $x \in \dom{R}$, then there exists some $y$ such that
$\pair{x, y} = \{\{x\}, \{x, y\}\} \in R$.
Then $\{x\} \in \bigcup R$ and $x \in \bigcup\bigcup R$.
On the other hand, if $x \in \ran{R}$, then there exists some $t$ such that
$\pair{t, x} = \{\{t\}, \{t, x\}\} \in R$.
Then $\{t, x\} \in \bigcup R$ and $x \in \bigcup\bigcup R$.
\paragraph{(ii)}%
\hyperlabel{par:exercise-3.7-ii}
Let $t \in \bigcup\bigcup R$.
Then there exists some member $T \in \bigcup R$ such that $t \in T$.
Likewise there exists some member $T' \in R$ such that $T \in T'$.
By definition of a relation, $T' = \pair{x, y} = \{\{x\}, \{x, y\}\}$ for
some sets $x$ and $y$.
Thus $t = x$ or $t = y$.
By \nameref{sub:exercise-3.6}, $t \in \dom{R}$ or $t \in \ran{R}$.
In other words, $t \in \fld{R}$.
\paragraph{Conclusion}%
Since \nameref{par:exercise-3.7-i} and \nameref{par:exercise-3.7-ii} hold,
$\fld{R} = \bigcup\bigcup{R}$.
\end{proof}
\subsection{\verified{Exercise 3.8}}%
\hyperlabel{sub:exercise-3.8}
Show that for any set $\mathscr{A}$:
\begin{align}
\dom{\bigcup{\mathscr{A}}}
& = \bigcup\;\{ \dom{R} \mid R \in \mathscr{A} \},
& \hyperlabel{sub:exercise-3.8-eq1} \\
\ran{\bigcup{\mathscr{A}}}
& = \bigcup\;\{ \ran{R} \mid R \in \mathscr{A} \}.
& \hyperlabel{sub:exercise-3.8-eq2}
\end{align}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_8\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_8\_ii}
We prove (i) \eqref{sub:exercise-3.8-eq1} and then (ii)
\eqref{sub:exercise-3.8-eq2}.
\paragraph{(i)}%
Let $x \in \dom{\bigcup{\mathscr{A}}}$.
By definition of a domain, there exists some $y$ such that
$\pair{x, y} \in \bigcup{\mathscr{A}}$.
By definition of the union of sets,
$\exists y, \exists R \in \mathscr{A}, \pair{x, y} \in R$.
Equivalently,
$\exists R \in \mathscr{A}, \exists y, \pair{x, y} \in R$.
By another application of the definition of a domain,
$\exists R \in \mathscr{A}, x \in \dom{R}$.
By another application of the definition of the union of sets,
$x \in \bigcup\;\{ \dom{R} \mid R \in \mathscr{A} \}$.
Since membership of these two sets holds biconditionally, it follows
\eqref{sub:exercise-3.8-eq1} holds.
\paragraph{(ii)}%
Let $x \in \ran{\bigcup{\mathscr{A}}}$.
By definition of a range, there exists some $t$ such that
$\pair{t, x} \in \bigcup{\mathscr{A}}$.
By definition of the union of sets,
$\exists t, \exists R \in \mathscr{A}, \pair{t, x} \in R$.
Equivalently,
$\exists R \in \mathscr{A}, \exists t, \pair{t, x} \in R$.
By another application of the definition of a range,
$\exists R \in \mathscr{A}, x \in \ran{R}$.
By another application of the definition of the union of sets,
$x \in \bigcup\;\{ \ran{R} \mid R \in \mathscr{A} \}$.
Since membership of these two sets holds biconditionally, it follows
\eqref{sub:exercise-3.8-eq2} holds.
\end{proof}
\subsection{\verified{Exercise 3.9}}%
\hyperlabel{sub:exercise-3.9}
Discuss the result of replacing the union operation by the intersection
operation in the preceding problem.
\begin{answer}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_9\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_9\_ii}
Replacing the union operation with the intersection problem produces the
following relationships
\begin{align}
\dom{\bigcap{\mathscr{A}}}
& \subseteq \bigcap\;\{ \dom{R} \mid R \in \mathscr{A} \},
& \hyperlabel{sub:exercise-3.9-eq1} \\
\ran{\bigcap{\mathscr{A}}}
& \subseteq \bigcap\;\{ \ran{R} \mid R \in \mathscr{A} \}.
& \hyperlabel{sub:exercise-3.9-eq2}
\end{align}
We prove (i) \eqref{sub:exercise-3.9-eq1} and then (ii)
\eqref{sub:exercise-3.9-eq2}.
\paragraph{(i)}%
Let $x \in \dom{\bigcap{\mathscr{A}}}$.
By definition of the \nameref{ref:domain} of a set,
$\exists y, \pair{x, y} \in \bigcap{\mathscr{A}}$.
By definition of the intersection of sets,
$\exists y, \forall R \in \mathscr{A}, \pair{x, y} \in R$.
But this implies that
$\forall R \in \mathscr{A}, \exists y, \pair{x, y} \in R$.
By another application of the definition of the \nameref{ref:domain} of a
set, $\forall R \in \mathscr{A}, x \in \dom{R}$.
By another application of the intersection of sets,
$x \in \bigcap\;\{ \dom{R} \mid R \in \mathscr{A} \}$.
Thus \eqref{sub:exercise-3.9-eq1} holds.
\paragraph{(ii)}%
Let $x \in \ran{\bigcap{\mathscr{A}}}$.
By definition of the \nameref{ref:range} of a set,
$\exists t, \pair{t, x} \in \bigcap{\mathscr{A}}$.
By definition of the intersection of sets,
$\exists t, \forall R \in \mathscr{A}, \pair{t, x} \in R$.
But this implies that
$\forall R \in \mathscr{A}, \exists t, \pair{t, x} \in R$.
By another application of the definition of the \nameref{ref:range} of a
set, $\forall R \in \mathscr{A}, x \in \ran{R}$.
By another application of the intersection of sets,
$x \in \bigcap\;\{ \ran{R} \mid R \in \mathscr{A} \}$.
Thus \eqref{sub:exercise-3.9-eq2} holds.
\end{answer}
\subsection{\unverified{Exercise 3.10}}%
\hyperlabel{sub:exercise-3.10}
Show that an ordered $4$-tuple is also an ordered $m$-tuple for every positive
integer $m$ less than $4$.
\begin{answer}
Let $\pair{x_1, x_2, x_3, x_4}$ denote an arbitrary $4$-tuple.
Then
\begin{align}
\pair{x_1, x_2, x_3, x_4}
& = \pair{\pair{x_1, x_2, x_3}, x_4}
& \hyperlabel{sub:exercise-7.10-eq1} \\
& = \pair{\pair{\pair{x_1, x_2}, x_3}, x_4}
& \hyperlabel{sub:exercise-7.10-eq2}
\end{align}
Here \eqref{sub:exercise-7.10-eq1} is an equivalent ordered $2$-tuple and
\eqref{sub:exercise-7.10-eq2} is an equivalent ordered $3$-tuple.
Furthermore, $\pair{x_1, x_2, x_3, x_4} = \pair{\pair{x_1, x_2, x_3, x_4}}$,
showing it can be represented as an ordered $1$-tuple as well.
\end{answer}
\subsection{\verified{Exercise 3.11}}%
\hyperlabel{sub:exercise-3.11}
Prove the following version (for functions) of the extensionality principle:
Assume that $F$ and $G$ are functions, $\dom{F} = \dom{G}$, and
$F(x) = G(x)$ for all $x$ in the common domain.
Then $F = G$.
\begin{proof}
\lean{Init/Core}{funext}
Let $F$ and $G$ be functions such that $\dom{F} = \dom{G}$ and $F(x) = G(x)$
for all $x$ in the common domain.
We prove that $\pair{x, y} \in F$ if and only if $\pair{x, y} \in G$.
But this follows immediately:
\begin{align*}
\pair{x, y} \in F
& \iff y = F(x) \land \pair{x, F(x)} \in F \\
& \iff y = G(x) \land \pair{x, G(x)} \in G \\
& \iff \pair{x, y} \in G.
\end{align*}
By the \nameref{ref:extensionality-axiom}, $F = G$.
\end{proof}
\subsection{\verified{Exercise 3.12}}%
\hyperlabel{sub:exercise-3.12}
Assume that $f$ and $g$ are functions and show that
$$f \subseteq g \iff \dom{f} \subseteq \dom{g} \land
(\forall x \in \dom{f}) f(x) = g(x).$$
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_12}
Let $f$ and $g$ be \nameref{ref:function}s.
\paragraph{($\Rightarrow$)}%
Suppose $f \subseteq g$.
Then for all \nameref{ref:ordered-pair}s $\pair{x, y}$,
$\pair{x, y} \in f$ implies $\pair{x, y} \in g$.
Thus every $x \in \dom{f}$ must be a member of $\dom{g}$.
Likewise, by definition of a function, $f$ and $g$ are single-valued.
Thus $f(x) = y$ and $g(x) = y$.
Since $x$ is an arbitrary element in the domain of $f$, it follows
$(\forall x \in \dom{f}) f(x) = y = g(x)$.
\paragraph{($\Leftarrow$)}%
Suppose $\dom{f} \subseteq \dom{g}$ and
$(\forall x \in \dom{f}) f(x) = g(x)$.
Let $\pair{x, y} \in f$.
By hypothesis, $x \in \dom{g}$ and $y = f(x) = g(x)$.
Thus $\pair{x, y} \in g$ as well.
Therefore $f \subseteq g$.
\end{proof}
\subsection{\verified{Exercise 3.13}}%
\hyperlabel{sub:exercise-3.13}
Assume that $f$ and $g$ are functions with $f \subseteq g$ and
$\dom{g} \subseteq \dom{f}$.
Show that $f = g$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_13}
Let $f$ and $g$ be functions such that $f \subseteq g$ and
$\dom{g} \subseteq \dom{f}$.
By \nameref{sub:exercise-3.12}, it follows that $\dom{f} \subseteq \dom{g}$
and $(\forall x \in \dom{f}) f(x) = g(x)$.
Since $\dom{g} \subseteq \dom{f}$ and $\dom{f} \subseteq \dom{g}$, it follows
that $\dom{g} = \dom{f}$.
By \nameref{sub:exercise-3.11}, $f = g$.
\end{proof}
\subsection{\verified{Exercise 3.14}}%
\hyperlabel{sub:exercise-3.14}
Assume that $f$ and $g$ are functions.
\begin{enumerate}[(a)]
\item Show that $f \cap g$ is a function.
\item Show that $f \cup g$ is a function iff $f(x) = g(x)$ for every $x$ in
$(\dom{f}) \cap (\dom{g})$.
\end{enumerate}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_14\_a}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_14\_b}
Assume $f$ and $g$ are \nameref{ref:function}s.
\paragraph{(a)}%
Consider $f \cap g$.
By definition of the intersection of sets, $f \cap g \subseteq f$.
Since $f$ is single-valued, it trivially follows that so must $f \cap g$.
Therefore $f \cap g$ is a function.
\paragraph{(b)}%
\subparagraph{($\Rightarrow$)}%
Suppose $f \cup g$ is a function.
Let $x \in (\dom{f}) \cap (\dom{g})$.
That is, $x \in \dom{f}$ and $x \in \dom{g}$.
Then there exists only one $y_1$ such that $\pair{x, y_1} \in f$.
Likewise there exists only one $y_2$ such that
$\pair{x, y_2} \in g$.
But $\pair{x, y_1} \in f \cup g$ and $\pair{x, y_2} \in f \cup g$.
Since $f \cup g$ is single-valued, it follows $y_1 = y_2$.
That is, $f(x) = g(x)$.
\subparagraph{($\Leftarrow$)}%
Suppose $f(x) = g(x)$ for every $x \in (\dom{f}) \cap (\dom{g})$.
Let $x \in \dom{(f \cup g)}$.
There are three cases to consider:
\begin{enumerate}[(i)]
\item Suppose $x \in \dom{f}$ but not in $\dom{g}$.
Since $f$ is a function, it follows $f \cup g$ has only one value $y$
such that $\pair{x, y} \in f \cup g$.
\item Suppose $x \in \dom{g}$ but not in $\dom{f}$.
Again, since $g$ is a function, it follows $f \cup g$ has only one
value $y$ such that $\pair{x, y} \in f \cup g$.
\item Suppose $x \in \dom{f}$ and $x \in \dom{g}$.
By hypothesis, $f(x) = g(x)$ meaning there is only one value $y$ such
that $\pair{x, y} \in f \cup g$.
\end{enumerate}
The above cases are exhaustive.
Together they imply that $f \cup g$ is single-valued, i.e. a function.
\end{proof}
\subsection{\verified{Exercise 3.15}}%
\hyperlabel{sub:exercise-3.15}
Let $\mathscr{A}$ be a set of functions such that for any $f$ and $g$ in
$\mathscr{A}$, either $f \subseteq g$ or $g \subseteq f$.
Show that $\bigcup{\mathscr{A}}$ is a function.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_15}
Let $\mathscr{A}$ be a set of \nameref{ref:function}s such that for any $f$
and $g$ in $\mathscr{A}$, either $f \subseteq g$ or $g \subseteq f$.
Let $x \in \dom{\bigcup{\mathscr{A}}}$.
Then there exists some $y_1$ such that
$\pair{x, y_1} \in \bigcup{\mathscr{A}}$.
Suppose there also exists some $y_2$ such that
$\pair{x, y_2} \in \bigcup{\mathscr{A}}$.
By definition of the union of sets, there exists some function
$f \in \mathscr{A}$ such that $\pair{x, y_1} \in f$.
Likewise there exists some function $g \in \mathscr{A}$ such that
$\pair{x, y_2} \in g$.
There are two cases to consider:
\paragraph{Case 1}%
Suppose $f \subseteq g$.
Then $\pair{x, y_1}, \pair{x, y_2} \in g$.
Since $g$ is a function, i.e. single-valued, $y_1 = y_2$.
\paragraph{Case 2}%
Suppose $g \subseteq f$.
Then $\pair{x, y_1}, \pair{x, y_2} \in f$.
Since $f$ is a function, i.e. single-valued, $y_1 = y_2$.
\paragraph{Conclusion}%
Since the above two cases applies for all
$x \in \dom{\bigcup{\mathscr{A}}}$ and appropriate choices of $f$ and $g$,
it follows $\bigcup{\mathscr{A}}$ is indeed a function.
\end{proof}
\subsection{\unverified{Exercise 3.16}}%
\hyperlabel{sub:exercise-3.16}
Show that there is no set to which every function belongs.
\begin{proof}
Every \nameref{ref:relation} consisting of a single \nameref{ref:ordered-pair}
is, by definition, a \nameref{ref:function}.
By \nameref{sub:exercise-3.4}, there is no set to which every ordered pair
belongs.
Thus there is no set to which every function of the described type belongs
either, let alone a set to which \textit{every} function belongs.
\end{proof}
\subsection{\verified{Exercise 3.17}}%
\hyperlabel{sub:exercise-3.17}
Show that the composition of two single-rooted sets is again single-rooted.
Conclude that the composition of two one-to-one functions is again one-to-one.
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_17\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_17\_ii}
Let $F$ and $G$ be two single-rooted sets.
Consider $F \circ G$.
By definition of the \nameref{ref:composition} of sets,
\begin{equation}
\hyperlabel{sub:exercise-3.17-eq1}
F \circ G = \{\pair{u, v} \mid \exists t(uGt \land tFv)\}.
\end{equation}
Consider any $v \in \ran{(F \circ G)}$.
By definition of the \nameref{ref:range} of a \nameref{ref:relation}, there
exists some $u_1$ such that $\pair{u_1, v} \in F \circ G$.
Let $u_2$ be a set such that $\pair{u_2, v} \in F \circ G$.
By \eqref{sub:exercise-3.17-eq1}, there exists a set $t_1$ such that
$\pair{u_1, t_1} \in G$ and $\pair{t_1, v} \in F$.
Likewise, there exists a set $t_2$ such that
$\pair{u_2, t_2} \in G$ and $\pair{t_2, v} \in F$.
But $F$ is single-rooted, meaning $t_1 = t_2$.
Likewise, because $G$ is single-rooted, $u_1 = u_2$.
Thus $F \circ G$ must also be single-rooted.
\suitdivider
Let $f$ and $g$ be one-to-one functions.
By \nameref{sub:theorem-3h}, $f \circ g$ is single-valued.
By the above, $f \circ g$ is single-rooted.
Thus $f \circ g$ is one-to-one.
\end{proof}
\subsection{\verified{Exercise 3.18}}%
\hyperlabel{sub:exercise-3.18}
Let $R$ be the set
$$\{ \pair{0, 1}, \pair{0, 2}, \pair{0, 3},
\pair{1, 2}, \pair{1, 3}, \pair{2, 3}\}.$$
Evaluate the following: $R \circ R$, $R \restriction \{1\}$,
$R^{-1} \restriction \{1\}$, $\img{R}{\{1\}}$, and $\img{R^{-1}}{\{1\}}$.
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_18\_i}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_18\_ii}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_18\_iii}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_18\_iv}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_18\_v}
\begin{enumerate}[(i)]
\item $R \circ R = \{ \pair{0, 2}, \pair{0, 3}, \pair{1, 3} \}$.
\item $R \restriction \{1\} = \{ \pair{1, 2}, \pair{1, 3} \}$.
\item $R^{-1} \restriction \{1\} = \{\pair{1, 0}\}$.
\item $\img{R}{\{1\}} = \{2, 3\}$.
\item $\img{R^{-1}}{\{1\}} = \{0\}$.
\end{enumerate}
\end{proof}
\subsection{\verified{Exercise 3.19}}%
\hyperlabel{sub:exercise-3.19}
Let $$A = \{
\pair{\emptyset, \{\emptyset, \{\emptyset\}\}},
\pair{\{\emptyset\}, \emptyset}
\}.$$
Evaluate each of the following: $A(\emptyset)$, $\img{A}{\emptyset}$,
$\img{A}{\{\emptyset\}}$, $\img{A}{\{\emptyset, \{\emptyset\}\}}$,
$A^{-1}$, $A \circ A$, $A \restriction \emptyset$,
$A \restriction \{\emptyset\}$, $A \restriction \{\emptyset, \{\emptyset\}\}$,
$\bigcup\bigcup A$.
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_i}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_ii}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_iii}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_iv}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_v}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_vi}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_vii}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_viii}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_ix}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_19\_x}
\begin{enumerate}[(i)]
\item $A(\emptyset) = \{\emptyset, \{\emptyset\}\}$.
\item $\img{A}{\emptyset} = \emptyset$.
\item $\img{A}{\{\emptyset\}} = \{\{\emptyset, \{\emptyset\}\}\}$.
\item $\img{A}{\{\emptyset, \{\emptyset\}\}} =
\{\{\emptyset, \{\emptyset\}\}, \emptyset\}$.
\item $A^{-1} = \{
\pair{\{\emptyset, \{\emptyset\}\}, \emptyset},
\pair{\emptyset, \{\emptyset\}}
\}$.
\item $A \circ A =
\{\pair{\{\emptyset\}, \{\emptyset, \{\emptyset\}\}}\}$.
\item $A \restriction \emptyset = \emptyset$
\item $A \restriction \{\emptyset\} =
\{\pair{\emptyset, \{\emptyset, \{\emptyset\}\}}\}$.
\item $A \restriction \{\emptyset, \{\emptyset\}\} = A$.
\item $\bigcup\bigcup A =
\{\emptyset, \{\emptyset\}, \{\emptyset, \{\emptyset\}\}\}$.
\end{enumerate}
\end{proof}
\subsection{\verified{Exercise 3.20}}%
\hyperlabel{sub:exercise-3.20}
Show that $F \restriction A = F \cap (A \times \ran{F})$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_20}
Let $F$ and $A$ be arbitrary sets.
By \nameref{sub:corollary-3c} and definition of the \nameref{ref:restriction},
intersection, and \nameref{ref:range} of sets,
\begin{align*}
F \restriction A
& = \{\pair{u, v} \mid uFv \land u \in A\} \\
& = \{\pair{u, v} \mid
uFv \land u \in A \land v \in \ran{F}\} \\
& = \{\pair{u, v} \mid uFv\} \cap
\{\pair{u, v} \mid u \in A \land v \in \ran{F}\} \\
& = F \cap \{\pair{u, v} \mid u \in A \land v \in \ran{F}\} \\
& = F \cap (A \times \ran{F}).
\end{align*}
\end{proof}
\subsection{\verified{Exercise 3.21}}%
\hyperlabel{sub:exercise-3.21}
Show that $(R \circ S) \circ T = R \circ (S \circ T)$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Relation}
{Set.Relation.comp\_assoc}
Let $R$, $S$, and $T$ be arbitrary sets.
By definition of the \nameref{ref:composition} of sets,
\begin{align*}
(R \circ S) \circ T
& = \{\pair{u, v} \mid
\exists t(uTt \land t(R \circ S)v)\} \\
& = \{\pair{u, v} \mid
\exists t(uTt \land (\exists a(tSa \land aRv))\} \\
& = \{\pair{u, v} \mid
\exists t, \exists a, (uTt \land tSa) \land aRv)\} \\
& = \{\pair{u, v} \mid
\exists a, \exists t, (uTt \land tSa) \land aRv)\} \\
& = \{\pair{u, v} \mid
\exists a, (\exists t(uTt \land tSa)) \land aRv)\} \\
& = \{\pair{u, v} \mid
\exists a, u(S \circ T)a \land aRv)\} \\
& = R \circ (S \circ T).
\end{align*}
\end{proof}
\subsection{\verified{Exercise 3.22}}%
\hyperlabel{sub:exercise-3.22}
Show that the following are correct for any sets.
\begin{enumerate}[(a)]
\item $A \subseteq B \Rightarrow \img{F}{A} \subseteq \img{F}{B}$.
\item $\img{(F \circ G)}{A} = \img{F}{\img{G}{A}}$.
\item $Q \restriction (A \cup B) =
(Q \restriction A) \cup (Q \restriction B)$.
\end{enumerate}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_22\_a}
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_22\_b}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_22\_c}
Let $A$, $B$, $F$, $G$, and $Q$ be arbitrary sets.
\paragraph{(a)}%
Suppose $A \subseteq B$.
Let $x \in \img{F}{A}$.
By definition of the \nameref{ref:image} of a set,
$\img{F}{A} = \{v \mid (\exists u \in A) uFv\}$.
Thus there exists some $u \in A$ such that $uFx$.
But $A \subseteq B$ meaning $u \in B$.
That is, $(\exists u \in B)uFx$.
Thus $$x \in \{v \mid (\exists u \in B)uFv\} = \img{F}{B}.$$
\paragraph{(b)}%
By definition of the \nameref{ref:composition} and \nameref{ref:image} of a
set,
\begin{align*}
\img{(F \circ G)}{A}
& = \{v \mid (\exists u \in A) u(F \circ G)v\} \\
& = \{v \mid (\exists u \in A) \pair{u, v} \in F \circ G\} \\
& = \{v \mid (\exists u \in A)
\pair{u, v} \in \{\pair{b, c} \mid
\exists a(bGa \land aFc)\}\} \\
& = \{v \mid \exists u \in A, \exists a, uGa \land aFv\} \\
& = \{v \mid \exists a, \exists u \in A, uGa \land aFv\} \\
& = \{v \mid \exists a, (\exists u \in A, uGa) \land aFv\} \\
& = \{v \mid \exists a \in \{w \mid (\exists u \in A)uGw\}, aFv\} \\
& = \{v \mid (\exists a \in \img{G}{A}) aFv\} \\
& = \img{F}{\img{G}{A}}.
\end{align*}
\paragraph{(c)}%
By definition of the \nameref{ref:restriction} of a set,
\begin{align*}
Q \restriction (A \cup B)
& = \{\pair{u, v} \mid uQv \land u \in A \cup B\} \\
& = \{\pair{u, v} \mid uQv \land (u \in A \lor u \in B)\} \\
& = \{\pair{u, v} \mid
(uQv \land u \in A) \lor (uQv \land u \in B)\} \\
& = \{\pair{u, v} \mid uQv \land u \in A\} \cup
\{\pair{u, v} \mid uQv \land u \in B\} \\
& = (Q \restriction A) \cup (Q \restriction B).
\end{align*}
\end{proof}
\subsection{\verified{Exercise 3.23}}%
\hyperlabel{sub:exercise-3.23}
Let $I_A$ be the identity function on the set $A$.
Show that for any sets $B$ and $C$,
$$B \circ I_A = B \restriction A \quad\text{and}\quad
\img{I_A}{C} = A \cap C.$$
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_23\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_23\_ii}
Let $I_A$ be the identity function on the set $A$.
That is, $I_A = \{\pair{u, u} \mid u \in A\}$.
Let $B$ and $C$ be any sets.
We show that (i) $B \circ I_A = B \restriction A$ and (ii)
$\img{I_A}{C} = A \cap C$.
\paragraph{(i)}%
We show that $B \circ I_A \subseteq B \restriction A$ and
$B \restriction A \subseteq B \circ I_A$.
\subparagraph{($\subseteq$)}%
Let $\pair{x, y} \in B \circ I_A$.
By definition of the \nameref{ref:composition} of sets,
there exists some $t$ such that $x(I_A)t$ and $tBy$.
By definition of the identity function, $I_A(x) = t$ implies $x = t$.
Thus $xBy$.
By hypothesis, $x \in \dom{(B \circ I_A)}$.
Therefore $x \in \dom{I_A} = A$.
Thus $$\pair{x, y} \in \{\pair{u, v} \mid u \in A \land uBv\}
= B \restriction A.$$
\subparagraph{($\supseteq$)}%
Let $\pair{x, y} \in B \restriction A$.
By definition of the \nameref{ref:restriction} of sets,
$x \in A$ and $xBy$.
But $I_A(x) = x$ meaning $\pair{I_A(x), y} \in B$.
In other words, $\pair{x, y} \in B \circ I_A$.
\paragraph{(ii)}%
By definition of the \nameref{ref:image} of sets,
\begin{align*}
\img{I_A}{C}
& = \{v \mid (\exists u \in C) \pair{u, v} \in I_A\} \\
& = \{v \mid \exists u \in C, u \in A \land u = v\} \\
& = \{v \mid v \in C \land v \in A\} \\
& = C \cap A.
\end{align*}
\end{proof}
\subsection{\verified{Exercise 3.24}}%
\hyperlabel{sub:exercise-3.24}
Show that for a function $F$,
$\img{F^{-1}}{A} = \{x \in \dom{F} \mid F(x) \in A\}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_24}
Let $F$ be a function.
By definition of the \nameref{ref:inverse} of a set,
\begin{align*}
\img{F^{-1}}{A}
& = \{x \mid (\exists y \in A) yF^{-1}x\} \\
& = \{x \mid (\exists y \in A) xFy\} \\
& = \{x \mid (\exists y \in A) \pair{x, y} \in F\} \\
& = \{x \mid x \in \dom{F} \land F(x) \in A\} \\
& = \{x \in \dom{F} \mid F(x) \in A\}.
\end{align*}
\end{proof}
\subsection{\verified{Exercise 3.25}}%
\hyperlabel{sub:exercise-3.25}
\begin{enumerate}[(a)]
\item Assume that $G$ is a one-to-one function.
Show that $G \circ G^{-1}$ is $I_{\ran{G}}$, the identity function on
$\ran{G}$.
\item Show that the result of part (a) holds for any function $G$, not
necessarily one-to-one.
\end{enumerate}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_25\_b}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_25\_a}
\paragraph{(b)}%
\hyperlabel{par:exercise-3.25-b}
Let $G$ be an arbitrary function.
We show that $G \circ G^{-1} \subseteq I_{\ran{G}}$ and that
$I_{\ran{G}} \subseteq G \circ G^{-1}$.
\subparagraph{($\subseteq$)}%
Let $\pair{x, y} \in G \circ G^{-1}$.
By definition of the \nameref{ref:composition} of sets, there exists some
set $t$ such that $x(G^{-1})t$ and $tGy$.
By definition of the \nameref{ref:inverse} of a set,
$$x(G^{-1})t \iff tGx.$$
The right hand side of the above biconditional indicates $x \in \ran{G}$.
Since $G$ is single-valued, $tGy \land tGx$ implies $x = y$.
Thus $\pair{x, y} \in I_{\ran{G}}$.
\subparagraph{($\supseteq$)}%
Let $\pair{x, x} \in I_{\ran{G}}$ where $x \in \ran{G}$.
By definition of the \nameref{ref:range} of a function, there exists some
$t$ such that $\pair{t, x} \in G$.
By definition of the \nameref{ref:inverse} of a set, it follows
$\pair{x, t} \in G^{-1}$.
Thus $\pair{x, x} \in G \circ G^{-1}$.
\subparagraph{Conclusion}%
Since $G \circ G^{-1}$ is a subset of $I_{\ran{G}}$ and vice versa, it
follows that these two sets are equal.
\paragraph{(a)}%
This immediately follows from part \nameref{par:exercise-3.25-b}.
\end{proof}
\subsection{\verified{Exercise 3.26}}%
\hyperlabel{sub:exercise-3.26}
Prove the second halves of parts (a) and (b) of Theorem 3K.
\begin{proof}
Refer to \nameref{sub:theorem-3k-a}, \nameref{sub:theorem-3k-b}, and
\nameref{sub:theorem-3k-c}.
\end{proof}
\subsection{\verified{Exercise 3.27}}%
\hyperlabel{sub:exercise-3.27}
Show that $\dom{(F \circ G)} = \img{G^{-1}}{\dom{F}}$ for any sets $F$ and $G$.
($F$ and $G$ need not be functions.)
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_27}
Let $F$ and $G$ be arbitrary sets.
We show that each side of our desired equality is a subset of the other.
\paragraph{($\subseteq$)}%
Let $x \in \dom{(F \circ G)}$.
Then there exists a set $y$ such that $\pair{x, y} \in F \circ G$.
By definition of the \nameref{ref:composition} of sets, there exists a set
$t$ such that $xGt$ and $tFy$.
Thus $t \in \dom{F}$.
Therefore
\begin{align*}
x
& \in \{v \mid (\exists t \in \dom{F}) vGt\} \\
& = \{v \mid (\exists t \in \dom{F}) t(G^{-1})v\} \\
& = \img{G^{-1}}{\dom{F}}.
\end{align*}
\paragraph{($\supseteq$)}%
Let $x \in \img{G^{-1}}{\dom{F}}$.
Then, by definition of the \nameref{ref:image} of a set, there exists some
$u \in \dom{F}$ such that $u(G^{-1})x$.
By definition of the \nameref{ref:inverse} of a set, $xGu$.
By definition of the \nameref{ref:domain} of a set, there exists some $t$
such that $uFt$.
Thus $xGu \land uFt$.
By definition of the \nameref{ref:composition} of sets,
$\pair{x, t} \in F \circ G$.
Therefore $x \in \dom{(F \circ G)}$.
\end{proof}
\subsection{\verified{Exercise 3.28}}%
\hyperlabel{sub:exercise-3.28}
Assume that $f$ is a one-to-one function from $A$ into $B$, and that $G$ is the
function with $\dom{G} = \powerset{A}$ defined by the equation
$G(X) = \img{f}{X}$.
Show that $G$ maps $\powerset{A}$ one-to-one into $\powerset{B}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_28}
By construction, $\dom{G} = \powerset{A}$.
Likewise, $\ran{G} \subseteq \powerset{B}$ by definition of the
\nameref{ref:image} of sets.
Thus $G$ maps $\powerset{A}$ into $\powerset{B}$.
Let $y \in \ran{G}$.
Then there exists an $X_1 \in \powerset{A}$ such that $\img{f}{X_1} = y$.
To prove $G$ is one-to-one into $\powerset{B}$, assume there exists an
$X_2 \in \powerset{A}$ such that $\img{f}{X_2} = y$.
All that remains is showing $X_1 = X_2$.
Let $t \in X_1$.
By definition of the \nameref{ref:image} of a set, $f(t) \in \img{f}{X_1}$.
Since $\img{f}{X_1} = \img{f}{X_2}$, it follows $f(t) \in \img{f}{X_2}$.
Because $f$ is one-to-one, $f(t) \in \img{f}{X_2}$ if and only if $t \in X_2$.
Thus $t \in X_1$ if and only if $t \in X_2$.
By the \nameref{ref:extensionality-axiom}, it follows $X_1 = X_2$.
\end{proof}
\subsection{\verified{Exercise 3.29}}%
\hyperlabel{sub:exercise-3.29}
Assume that $f \colon A \rightarrow B$ and define a function
$G \colon B \rightarrow \powerset{A}$ by
\begin{equation}
\hyperlabel{sub:exercise-3.29-eq1}
G(b) = \{x \in A \mid f(x) = b\}.
\end{equation}
Show that if $f$ maps $A$ \textit{onto} $B$, then $G$ is one-to-one.
Does the converse hold?
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_39}
Let $f \colon A \rightarrow B$ such that $f$ maps $A$ onto $B$.
Define $G \colon B \rightarrow \powerset{A}$ by
\eqref{sub:exercise-3.29-eq1}.
Let $y \in \ran{G}$.
By definition of the \nameref{ref:range} of a set, there exists an
$x_1 \in B$ such that $G(x_1) = y$.
To prove $G$ is one-to-one, suppose there exists an $x_2 \in B$ such
that $G(x_2) = y$.
All that remains is proving $x_1 = x_2$.
By \eqref{sub:exercise-3.29-eq1}, it follows
\begin{align*}
G(x_1) & = \{x \in A \mid f(x) = x_1\} \\
G(x_2) & = \{x \in A \mid f(x) = x_2\}.
\end{align*}
Since $f$ maps $A$ onto $B$, $\ran{f} = B$.
Thus $x_1, x_2 \in \ran{f}$.
By definition of the \nameref{ref:range} of a set, there exist some $t \in A$
such that $f(t) = x_1$.
Therefore $t \in G(x_1)$.
By the \nameref{ref:extensionality-axiom}, $t \in G(x_2)$.
Then $f(t) = x_2$.
But $f$ is a \nameref{ref:function}, i.e. single-valued.
Thus $x_1 = x_2$.
\suitdivider
If $G$ is one-to-one, it does not follow that $f$ maps $A$ onto $B$.
As a counterexample, let $f \colon \{1\} \rightarrow \{1, 2\}$ given by
$f(x) = x$.
Define $G \colon \{1, 2\} \rightarrow \powerset{\{1\}}$ by
$$G(b) = \{x \in \{1\} \mid f(x) = b\}.$$
$G$ is trivially one-to-one since $G(1) = \{1\}$ and $G(2) = \emptyset$.
But $f$ does not map onto $\{1, 2\}$; there is no element in its domain that
corresponds to value $2$.
\end{proof}
\subsection{\sorry{Exercise 3.30}}%
\hyperlabel{sub:exercise-3.30}
Assume that $F \colon \powerset{A} \rightarrow \powerset{A}$ and that $F$ has
the monotonicity property:
$$X \subseteq Y \subseteq A \Rightarrow F(X) \subseteq F(Y).$$
Define
$$B = \bigcap\{X \subseteq A \mid F(X) \subseteq X\} \quad\text{and}\quad
C = \bigcup\{X \subseteq A \mid X \subseteq F(X)\}.$$
\subsubsection{\sorry{Exercise 3.30 (a)}}%
\hyperlabel{ssub:exercise-3.30-a}
Show that $F(B) = B$ and $F(C) = C$.
\begin{proof}
TODO
\end{proof}
\subsubsection{\sorry{Exercise 3.30 (b)}}%
\hyperlabel{ssub:exercise-3.30-b}
Show that if $F(X) = X$, then $B \subseteq X \subseteq C$.
\begin{proof}
TODO
\end{proof}
\subsection{\unverified{Exercise 3.31}}%
\hyperlabel{sub:exercise-3.31}
Show that from the first form of the axiom of choice we can prove the second
form, and conversely.
\begin{proof}
We prove the first form holds if and only if the second form holds.
\paragraph{($\Rightarrow$)}%
We assume the first form of the axiom of choice.
Let $I$ be a set and $H$ be a function with $\dom{H} = I$.
Furthermore, suppose $H(i) \neq \emptyset$ for all $i \in I$.
By definition of the \nameref{ref:cartesian-product},
$$\bigtimes_{i \in I} H(i) = \{f \mid
f \text{ is a function with } \dom{f} = I \text{ and }
(\forall i \in I) f(i) \in H(i)\}.$$
Consider the relation $R$ formed by
$$R = \bigcup_{i \in I} \{i\} \times H(i).$$
By the \nameref{ref:axiom-of-choice-1}, there exists a function
$f \subseteq R$ with $\dom{f} = I$.
Furthermore, for all $i \in I$, it must be $f(i) \in H(i)$ by construction.
Then $f$ is a member of $\bigtimes_{i \in I} H(i)$.
That is, $\bigtimes_{i \in I} H(i) \neq \emptyset$.
\paragraph{($\Leftarrow$)}%
We assume the second form of the axiom of choice.
Let $R$ be an arbitrary relation.
There are two cases to consider:
\subparagraph{Case 1}%
Suppose $\ran{R} = \emptyset$.
Then $R = \emptyset$.
Thus the function $\emptyset \subseteq R$ satisfies
$\dom{\emptyset} = \dom{R}$.
\subparagraph{Case 2}%
Suppose $\ran{R} \neq \emptyset$.
Let $I = \dom{R}$ and define $H \colon I \rightarrow \{\ran{R}\}$ as
$H(i) = \ran{R}$ for all $i \in I$.
By the \nameref{ref:axiom-of-choice-2},
$\bigtimes_{i \in I} H(i) \neq \emptyset$.
By definition of the \nameref{ref:cartesian-product}, there exists some
function $f$ such that $\dom{f} = I$ and
$(\forall i \in I) f(i) \in H(i) = \ran{R}$.
Thus $\dom{f} = \dom{R}$ and $f \subseteq R$ as desired.
\paragraph{Conclusion}%
The above cases are exhaustive and yield the same conclusion: for any
relation $R$ there exists a function $f \subseteq R$ such that
$\dom{f} = \dom{R}$.
\end{proof}
\subsection{\verified{Exercise 3.32a}}%
\hyperlabel{sub:exercise-3.32-a}
Show that $R$ is symmetric iff $R^{-1} \subseteq R$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_32\_a}
\paragraph{($\Rightarrow$)}%
Suppose $R$ is \nameref{ref:symmetric}.
Let $\pair{x, y} \in R^{-1}$.
By definition of the \nameref{ref:inverse} of a set,
$\pair{y, x} \in R$.
By symmetry, $\pair{x, y} \in R$.
Thus $R^{-1} \subseteq R$.
\paragraph{($\Leftarrow$)}%
Suppose $R^{-1} \subseteq R$.
Let $\pair{x, y} \in R$.
By definition of the \nameref{ref:inverse} of a set,
$\pair{y, x} \in R^{-1}$.
Since $R^{-1} \subseteq R$, $\pair{y, x} \in R$.
Therefore $\pair{x, y}$ and $\pair{y, x}$ are both in $R$.
In other words, $R$ is symmetric.
\end{proof}
\subsection{\verified{Exercise 3.32b}}%
\hyperlabel{sub:exercise-3.32-b}
Show that $R$ is transitive iff $R \circ R \subseteq R$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_32\_b}
\paragraph{($\Rightarrow$)}%
Suppose $R$ is \nameref{ref:transitive}.
Let $\pair{x, y} \in R \circ R$.
By definition of the \nameref{ref:composition} of a set,
there exists some $t$ such that $xRt \land tRy$.
That is, $\pair{x, t} \in R$ and $\pair{t, y} \in R$.
Since $R$ is transitive, it follows $\pair{x, y} \in R$.
\paragraph{($\Leftarrow$)}%
Suppose $R \circ R \subseteq R$.
Let $\pair{x, y} \pair{y, z} \in R$.
By definition of the \nameref{ref:composition} of a set,
$$R \circ R = \{\pair{u, v} \mid \exists t(uRt \land tRv)\}.$$
Then $\pair{x, z} \in R \circ R$.
Since $R \circ R \subseteq R$, it follows $\pair{x, z} \in R$.
Thus $R$ is transitive.
\end{proof}
\subsection{\verified{Exercise 3.33}}%
\hyperlabel{sub:exercise-3.33}
Show that $R$ is a symmetric and transitive relation iff $R = R^{-1} \circ R$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_33}
By definition of the \nameref{ref:inverse} and \nameref{ref:composition}
of sets,
\begin{align}
R^{-1} \circ R
& = \{ (u, v) \mid \exists t(uRt \land tR^{-1}v) \}
\nonumber \\
& = \{ (u, v) \mid \exists t(uRt \land vRt) \}.
\hyperlabel{sub:exercise-3.33-eq1}
\end{align}
\paragraph{($\Rightarrow$)}%
Suppose $R$ is symmetric and transitive.
We now show that $R \subseteq R^{-1} \circ R$ and
$R^{-1} \circ R \subseteq R$.
\subparagraph{($\subseteq$)}%
Let $\pair{x, y} \in R$.
Since $R$ is symmetric, $\pair{y, x} \in R$.
Since $R$ is transitive, $\pair{x, x} \in R$.
Then there exists a $t$ such that $\pair{x, t} \in R$ and
$\pair{y, t} \in R$, namely $t = x$.
By \eqref{sub:exercise-3.33-eq1},
$\pair{x, y} \in R^{-1} \circ R$.
\subparagraph{($\supseteq$)}%
Let $\pair{x, y} \in R^{-1} \circ R$.
By \eqref{sub:exercise-3.33-eq1}, there exists some $t$ such that
$\pair{x, t} \in R$ and $\pair{y, t} \in R$.
But $R$ is symmetric meaning $\pair{t, y} \in R$.
Since $R$ is transitive, it follows $\pair{x, y} \in R$.
\paragraph{($\Leftarrow$)}%
Suppose $R = R^{-1} \circ R$.
We prove that (i) $R$ is symmetric and (ii) $R$ is transitive.
\subparagraph{(i)}%
\hyperlabel{spar:exercise-3.33-i}
First we note that $R$ is equal to its inverse:
\begin{align}
R^{-1}
& = (R^{-1} \circ R)^{-1} \nonumber \\
& = R^{-1} \circ (R^{-1})^{-1}
& \textref{sub:theorem-3i} \nonumber \\
& = R^{-1} \circ R
& \textref{sub:theorem-3e} \nonumber \\
& = R \hyperlabel{sub:exercise-3.33-eq2}.
\end{align}
Now let $\pair{x, y} \in R$.
By \eqref{sub:exercise-3.33-eq2} $\pair{x, y} \in R^{-1}$.
By definition of the \nameref{ref:inverse} of a set,
$\pair{y, x} \in R$.
Thus $R$ is symmetric.
\subparagraph{(ii)}%
Let $\pair{x, y}, \pair{y, z} \in R$.
By \nameref{spar:exercise-3.33-i}, $R$ is symmetric.
Thus $\pair{z, y} \in R$.
By \eqref{sub:exercise-3.33-eq1}, it follows
$\pair{x, z} \in R^{-1} \circ R$.
Since $R^{-1} \circ R = R$, it follows $\pair{x, z} \in R$.
Thus $R$ is transitive.
\end{proof}
\subsection{\verified{Exercise 3.34}}%
\hyperlabel{sub:exercise-3.34}
Assume that $\mathscr{A}$ is a nonempty set, every member of which is a
transitive relation.
\begin{enumerate}[(a)]
\item Is the set $\bigcap{\mathscr{A}}$ a transitive relation?
\item Is $\bigcup{\mathscr{A}}$ a transitive relation?
\end{enumerate}
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_34\_a}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_34\_b}
\paragraph{(a)}%
Because $\mathscr{A} \neq \emptyset$, $\bigcap{\mathscr{A}}$ is
well-defined.
We prove that $\bigcap{\mathscr{A}}$ is a transitive relation.
Let $\pair{x, y}, \pair{y, z} \in \bigcap{\mathscr{A}}$.
Then forall $A$ in $\mathscr{A}$, it follows
$\pair{x, y}, \pair{y, z} \in A$.
Since $A$ is transitive, it follows $\pair{x, z} \in A$.
Since this holds for all $A \in \mathscr{A}$, it follows that
$\pair{x, z} \in A$ as well.
Thus $\bigcap{\mathscr{A}}$ is transitive.
\paragraph{(b)}%
We show that $\bigcup{\mathscr{A}}$ is not necessarily transitive with a
counterexample.
Suppose $$\mathscr{A} = \{
\{\pair{1, 2}, \pair{2, 3}, \pair{1, 3}\}, \{\pair{2, 1}\}
\}.$$
Notice that the two members of $\mathscr{A}$ are transitive relations.
Now $$\bigcup{\mathscr{A}} = \{
\pair{1, 2}, \pair{2, 3}, \pair{1, 3}, \pair{2, 1},
\}.$$
But the above cannot be transitive, for $\pair{1, 2}$ and $\pair{2, 1}$ are
members of the set, but $\pair{1, 1}$ is not.
\end{proof}
\subsection{\verified{Exercise 3.35}}%
\hyperlabel{sub:exercise-3.35}
Show that for any $R$ and $x$, we have $[x]_R = \img{R}{\{x\}}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_35}
Let $R$ and $x$ be arbitrary sets.
Then
\begin{align*}
[x]_R
& = \{t \mid xRt\} \\
& = \{t \mid (\exists u \in \{x\})uRt\} \\
& = \img{R}{\{x\}}.
\end{align*}
\end{proof}
\subsection{\verified{Exercise 3.36}}%
\hyperlabel{sub:exercise-3.36}
Assume that $f \colon A \rightarrow B$ and that $R$ is an equivalence relation
on $B$.
Define $Q$ to be the set
\begin{equation}
\hyperlabel{sub:exercise-3.36-eq1}
\{\pair{x, y} \in A \times A \mid \pair{f(x), f(y)} \in R\}.
\end{equation}
Show that $Q$ is an equivalence relation on $A$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_36}
We prove that (i) $Q$ is \nameref{ref:reflexive} on $A$, (ii) $Q$ is
\nameref{ref:symmetric}, and (iii) $Q$ is \nameref{ref:transitive}.
\paragraph{(i)}%
Let $x \in A$.
By hypothesis, $f(x) \in B$.
Since $R$ is an equivalence relation on $B$, $R$ is reflexive on $B$.
Thus $\pair{f(x), f(x)} \in R$.
But then \eqref{sub:exercise-3.36-eq1} implies $\pair{x, x} \in Q$.
Thus $Q$ is reflexive on $A$.
\paragraph{(ii)}%
Let $\pair{x, y} \in Q$.
By \eqref{sub:exercise-3.36-eq1}, $\pair{f(x), f(y)} \in R$.
Since $R$ is an equivalence relation on $B$, $R$ is symmetric.
Thus $\pair{f(y), f(x)} \in R$.
But then \eqref{sub:exercise-3.36-eq1} implies $\pair{y, x} \in Q$.
Thus $Q$ is symmetric.
\paragraph{(iii)}%
Let $\pair{x, y}, \pair{y, z} \in Q$.
By \eqref{sub:exercise-3.36-eq1},
$\pair{f(x), f(y)}, \pair{f(y), f(z)} \in R$.
Since $R$ is an equivalence relation on $B$, $R$ is transitive.
Thus $\pair{f(x), f(z)} \in R$.
But then \eqref{sub:exercise-3.36-eq1} implies $\pair{x, z} \in Q$.
Thus $Q$ is transitive.
\end{proof}
\subsection{\verified{Exercise 3.37}}%
\hyperlabel{sub:exercise-3.37}
Assume that $\Pi$ is a partition of a set $A$.
Define the relation $R_\Pi$ as follows:
\begin{equation}
\hyperlabel{sub:exercise-3.37-eq1}
xR_{\Pi}y \iff (\exists B \in \Pi)(x \in B \land y \in B).
\end{equation}
Show that $R_\Pi$ is an equivalence relation on $A$.
(This is a formalized version of the discussion at the beginning of this
section.)
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_37}
We prove that (i) $R_\Pi$ is \nameref{ref:reflexive} on $B$, (ii) $R_\Pi$ is
\nameref{ref:symmetric}, and (iii) $R_\Pi$ is \nameref{ref:transitive}.
\paragraph{(i)}%
Let $x \in A$.
By definition of a \nameref{ref:partition}, there exists some nonempty set
$B \in \Pi$ such that $x \in B$.
Thus $(\exists B \in \Pi)(x \in B \land x \in B)$.
By \eqref{sub:exercise-3.37-eq1}, $\pair{x, x} \in R_\Pi$.
Therefore $R_\Pi$ is reflexive on $A$.
\paragraph{(ii)}%
Let $\pair{x, y} \in R_\Pi$.
By \eqref{sub:exercise-3.37-eq1}, there exists some $B \in \Pi$ such that
$x \in B \land y \in B$.
But then $y \in B \land x \in B$.
Thus $\pair{y, x} \in R_\Pi$.
In other words, $R_\Pi$ is symmetric.
\paragraph{(iii)}%
Let $\pair{x, y}, \pair{y, z} \in R_\Pi$.
By \eqref{sub:exercise-3.37-eq1}, there exists some $B_1 \in \Pi$ such that
$x \in B_1 \land y \in B_1$.
Likewise there exists some $B_2 \in \Pi$ such that
$y \in B_2 \land z \in B_2$.
But $\Pi$ is a \nameref{ref:partition} meaning $y \in B_1$ and $y \in B_2$
if $B_1 = B_2$.
Therefore $x \in B_1 \land z \in B_1$ and $\pair{x, z} \in R_\Pi$.
In other words, $R_\Pi$ is transitive.
\end{proof}
\subsection{\verified{Exercise 3.38}}%
\hyperlabel{sub:exercise-3.38}
\nameref{sub:theorem-3p} shows that $A / R$ is a partition of $A$ whenever $R$
is an equivalence relation on $A$.
Show that if we start with the equivalence relation $R_\Pi$ of the preceding
exercise, then the partition $A / R_\Pi$ is just $\Pi$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_38}
By definition,
\begin{equation}
\hyperlabel{sub:exercise-3.38-eq1}
R_\Pi = \{ (x, y) \mid (\exists B \in \Pi)(x \in B \land y \in B) \}.
\end{equation}
We prove that $A / R_\Pi = \Pi$.
By the \nameref{ref:extensionality-axiom}, these two sets are equal when
$$B \in A / R_\Pi \iff B \in \Pi.$$
We prove both directions of this biconditional.
\paragraph{($\Rightarrow$)}%
Suppose $B \in A / R_\Pi$.
By \nameref{sub:exercise-3.37}, $R_\Pi$ is an equivalence class.
Then, by definition of a \nameref{ref:quotient-set},
$$A / R_\Pi = \{[x]_{R_\Pi} \mid x \in A\},$$
whose members are the \nameref{ref:equivalence-class}es.
Thus there exists some $x \in A$ such that $B = [x]_{R_\Pi}$.
By definition of a \nameref{ref:partition}, there exists a unique set
$B' \in \Pi$ containing $x$.
Thus it suffices to prove that $B = B'$, for then $B = [x]_{R_\Pi} = B'$ is
a member of $\Pi$ as desired.
We proceed by extensionality again; that is, we show
$$y \in B \iff y \in B'.$$
\subparagraph{($\rightarrow$)}%
Suppose $y \in B$.
Then
\begin{align*}
y
& \in B = [x]_{R_\Pi} \\
& = \{t \mid \pair{x, t} \in R_\Pi\} \\
& = \{t \mid (\exists B_1 \in \Pi)(x \in B_1 \land t \in B_1)\}.
& \eqref{sub:exercise-3.38-eq1}
\end{align*}
Thus there exists some $B_1 \in \Pi$ such that $x \in B_1$ and
$y \in B_1$.
By definition of a \nameref{ref:partition}, $B_1 \in \Pi$ is the unique
member of $\Pi$ containing $y$.
Thus $B_1 = B'$ meaning $y \in B'$ as desired.
\subparagraph{($\leftarrow$)}%
Suppose $y \in B'$.
By construction, $x \in B'$.
Then there exists a set $B_1$ such that $x \in B_1$ and $y \in B_1$,
namely $B'$.
Therefore
\begin{align*}
y
& \in \{t \mid (\exists B_1 \in \Pi)(x \in B_1 \land t \in B_1)\} \\
& = \{t \mid \pair{x, t} \in R_\Pi\} \\
& = [x]_{R_\Pi} = B.
\end{align*}
\subparagraph{Conclusion}%
By the \nameref{ref:extensionality-axiom}, it follows $B = B'$.
Since $B' \in P$, it also follows $B \in P$.
\paragraph{($\Leftarrow$)}%
Let $B \in \Pi$.
By definition of a \nameref{ref:partition}, $B$ is nonempty.
Let $x \in B$.
By definition of a set, $B = \{t \mid x \in B \land t \in B\}$.
By definition of a \nameref{ref:partition}, every member of $B$ must belong
to only $B$ (i.e. no other sets in the partition).
Thus we can equivalently write
\begin{align*}
B
& = \{t \mid (\exists B_1 \in \Pi)(x \in B_1 \land t \in B_1)\} \\
& = \{ t \mid \pair{x, t} \in R_\Pi \} \\
& = [x]_{R_\Pi}.
\end{align*}
Therefore $B \in A / R_{\Pi}$.
\end{proof}
\subsection{\verified{Exercise 3.39}}%
\hyperlabel{sub:exercise-3.39}
Assume that we start with an equivalence relation $R$ on $A$ and define $\Pi$ to
be the partition $A / R$.
Show that $R_\Pi$, as defined in Exercise 37, is just $R$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_39}
By definition,
\begin{equation}
\hyperlabel{sub:exercise-3.39-eq1}
R_\Pi = \{ (x, y) \mid (\exists B \in \Pi)(x \in B \land y \in B) \}.
\end{equation}
We prove that $R_\Pi = R$.
By the \nameref{ref:extensionality-axiom}, these two sets are equal when
$$(x, y) \in R_\Pi \iff (x, y) \in R.$$
We prove both directions of this biconditional.
\paragraph{($\Rightarrow$)}%
Let $(x, y) \in R_\Pi$.
By \eqref{sub:exercise-3.39-eq1}, there exists some $B \in \Pi$ such that
$x \in B$ and $y \in B$.
Since $\Pi = A / R = \{[x]_R \mid x \in A\}$, there must exist some
$z \in A$ such that $B = [z]_R$.
By definition of an \nameref{ref:equivalence-class}, $x \in [z]_R$ implies
that $zRx$ and $y \in [z]_R$ implies $zRy$.
Since $R$ is \nameref{ref:symmetric}, $xRz$.
Since $R$ is \nameref{ref:transitive}, $xRy$.
\paragraph{($\Leftarrow$)}%
Let $(x, y) \in R$.
By definition of an \nameref{ref:equivalence-class}, $x \in [x]_R$ and
$y \in [x]_R$.
Note also that $[x]_R \in A / R = \Pi$.
Thus there exists some $B \in \Pi$ such that $x \in B$ and $y \in B$, namely
$B = [x]_R$.
By \eqref{sub:exercise-3.39-eq1}, $(x, y) \in R_\Pi$.
\end{proof}
\subsection{\unverified{Exercise 3.40}}%
\hyperlabel{sub:exercise-3.40}
Define an equivalence relation $R$ on the set $P$ of positive integers by
$$mRn \iff m \text{ and } n \text{ have the same number of prime factors}.$$
Is there a function $f \colon P / R \rightarrow P / R$ such that
$f([n]_R) = [3n]_R$ for each $n$?
\begin{proof}
Define $g \colon P \rightarrow P$ as $g(x) = 3x$ for all $x \in P$.
We first show that $g$ is \nameref{ref:compatible} with $R$.
Let $m, n \in P$ such that $mRn$.
Then $m$ and $n$ have the same prime factors.
Then $3m$ has one additional prime factor than $m$, namely $3$.
Likewise $3n$ has one additional prime factor than $n$, also $3$.
Thus $(3m)R(3n)$, i.e. $g$ is compatible with $R$.
By \nameref{sub:theorem-3q}, it follows there exists a unique function
$f \colon P / R \rightarrow P / R$ such that $f([n]_R) = [g(n)]_R = [3n]_R$
as expected.
\end{proof}
\subsection{\unverified{Exercise 3.41}}%
\hyperlabel{sub:exercise-3.41}
Let $\mathbb{R}$ be the set of real numbers and define the relation $Q$ on
$\mathbb{R} \times \mathbb{R}$ by $\pair{u, v}Q\pair{x, y}$ iff
$u + y = x + v$.
\subsubsection{\verified{Exercise 3.41a}}%
\hyperlabel{ssub:exercise-3.41-a}
Show that $Q$ is an equivalence relation on $\mathbb{R} \times \mathbb{R}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_41\_a}
We show (i) $Q$ is \nameref{ref:reflexive} on $\mathbb{R} \times \mathbb{R}$,
(ii) $Q$ is \nameref{ref:symmetric}, and (iii) $Q$ is
\nameref{ref:transitive}.
\paragraph{(i)}%
Let $\pair{x, y} \in R \times R$.
Since $x + y = x + y$, it immediately follows $\pair{x, y}Q\pair{x, y}$.
Thus $Q$ is reflexive on $\mathbb{R}$.
\paragraph{(ii)}%
Let $\pair{\pair{u, v}, \pair{x, y}} \in Q$.
Then $u + y = x + v$.
Likewise, $x + v = u + y$.
This immediately implies that $\pair{\pair{x, y}, \pair{u, v}} \in Q$.
Thus $Q$ is symmetric.
\paragraph{(iii)}%
Let $\pair{\pair{u, v}, \pair{x, y}} \in Q$ and
$\pair{\pair{x, y}, \pair{a, b}} \in Q$.
Then $u + y = x + v$ and $x + b = a + y$.
Rearranging terms, we have $u - v = x - y$ and $x - y = a - b$.
Thus $u - v = a - b$.
Rearranging terms once more yields $u + b = a + v$.
Thus $\pair{\pair{u, v}, \pair{a, b}} \in Q$.
Therefore $Q$ is transitive.
\end{proof}
\subsubsection{\unverified{Exercise 3.41b}}%
\hyperlabel{ssub:exercise-3.41-b}
Is there a function $G \colon (\mathbb{R} \times \mathbb{R}) / Q
\rightarrow (\mathbb{R} \times \mathbb{R}) / Q$ satisfying the equation
\begin{equation}
\hyperlabel{ssub:exercise-3.41-b-eq1}
G([\pair{x, y}]_Q) = [\pair{x + 2y, y + 2x}]_Q?
\end{equation}
\begin{proof}
Let $f \colon \mathbb{R} \times \mathbb{R}
\rightarrow \mathbb{R} \times \mathbb{R}$ be given by
$f(\pair{x, y}) = \pair{x + 2y, y + 2x}$.
We show (i) that $f$ is \nameref{ref:compatible} with $Q$ and then (ii)
there exists such a function satisfying \eqref{ssub:exercise-3.41-b-eq1}.
\paragraph{(i)}%
\hyperlabel{par:exercise-3.41-b-i}
Let $\pair{u, v}, \pair{x, y} \in \mathbb{R} \times \mathbb{R}$ such that
$\pair{u, v} Q \pair{x, y}$.
Thus
\begin{equation}
\hyperlabel{ssub:exercise-3.41-b-eq2}
u + y = x + v
\end{equation}
Next consider
\begin{align*}
f(\pair{u, v}) & = \pair{u + 2v, v + 2u}, \\
f(\pair{x, y}) & = \pair{x + 2y, y + 2x}.
\end{align*}
Then
\begin{align*}
u + y & = x + v \\
\iff 3u + 3y & = 3x + 3v \\
\iff (u + y) + (2u + 2y) & = (x + v) + (2x + 2v) \\
\iff (x + v) + (2u + 2y) & = (u + y) + (2x + 2v)
& \eqref{ssub:exercise-3.41-b-eq2} \\
\iff (x + 2y) + (v + 2u) & = (u + 2v) + (y + 2x) \\
\iff (u + 2v) + (y + 2x) & = (x + 2y) + (v + 2u).
\end{align*}
This last equality shows $f(\pair{u, v}) \,Q\, f(\pair{x, y})$.
Thus $f$ is compatible with $Q$.
\paragraph{(ii)}%
By \nameref{par:exercise-3.41-b-i} and \nameref{sub:theorem-3q}, there
exists a unique $G \colon (\mathbb{R} \times \mathbb{R}) / Q \rightarrow
(\mathbb{R} \times \mathbb{R}) / Q$ satisfying
\eqref{ssub:exercise-3.41-b-eq1}.
\end{proof}
\subsection{\sorry{Exercise 3.42}}%
\hyperlabel{sub:exercise-3.42}
State precisely the "analogous results" mentioned in Theorem 3Q.
(This will require extending the concept of compatibility in a suitable way.)
\begin{proof}
TODO
\end{proof}
\subsection{\verified{Exercise 3.43}}%
\hyperlabel{sub:exercise-3.43}
Assume that $R$ is a linear ordering on a set $A$.
Show that $R^{-1}$ is also a linear ordering on $A$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_43}
Assume that $R$ is a \nameref{ref:linear-ordering} on a set $A$.
Then $R$ is \nameref{ref:transitive} and \nameref{ref:trichotomous}.
We show that (i) $R^{-1}$ is transitive and (ii) $R^{-1}$ is trichotomous.
\paragraph{(i)}%
\hyperlabel{par:exercise-3.43-i}
Let $\pair{x, y}, \pair{y, z} \in R^{-1}$.
By definition of the \nameref{ref:inverse} of a set,
$\pair{y, x}$, $\pair{z, y} \in R$.
Since $R$ is transitive, it must be that $\pair{z, x} \in R$.
Then $\pair{x, z} \in R^{-1}$.
Thus $R^{-1}$ is transitive.
\paragraph{(ii)}%
\hyperlabel{par:exercise-3.43-ii}
Let $x, y \in A$.
Since $R$ is trichotomous on $A$, it follows that exactly one of the
following conditions hold: $$xRy, \quad x = y, \quad yRx.$$
By definition of the \nameref{ref:inverse} of a set, the above possibilities
are equivalently expressed as
$$yR^{-1}x, \quad x = y, \quad xR^{-1}y.$$
Thus $R^{-1}$ is trichotomous.
\paragraph{Conclusion}%
Since $R^{-1}$ is transitive by \nameref{par:exercise-3.43-i} and
trichotomous by \nameref{par:exercise-3.43-ii}, it follows $R^{-1}$ is a
linear ordering on $A$.
\end{proof}
\subsection{\verified{Exercise 3.44}}%
\hyperlabel{sub:exercise-3.44}
Assume that $<$ is a linear ordering on a set $A$.
Assume that $f \colon A \rightarrow A$ and that $f$ has the property that
whenever $x < y$, then $f(x) < f(y)$.
Show that $f$ is one-to-one and that whenever $f(x) < f(y)$, then $x < y$.
\begin{proof}
\statementpadding
\lean*{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_44\_i}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_44\_ii}
We show that (i) $f$ is one-to-one and (ii) whenever $f(x) < f(y)$, then
$x < y$.
\paragraph{(i)}%
Let $y \in \ran{f}$.
By definition of the \nameref{ref:range} of a set, there exists some
$x_1 \in A$ such that $f(x_1) = y$.
Suppose there exists some $x_2 \in A$ such that $f(x_2) = y$.
We prove $f$ is one-to-one by showing $x_1 = x_2$.
Because $<$ is a linear ordering on $A$, there exist three cases to
consider:
\subparagraph{Case 1}%
Assume $x_1 < x_2$.
By hypothesis, $f$ is monotonic.
Thus $f(x_1) < f(x_2)$.
But $<$ is a trichotomous relation meaning it is not possible for
\textit{both} $f(x) = f(y)$ and $f(x) < f(y)$.
Thus our original assumption must be wrong.
\subparagraph{Case 2}%
Assume $x_1 = x_2$.
Then we are immediately finished.
\subparagraph{Case 3}%
Assume $x_1 > x_2$.
By hypothesis, $f$ is monotonic.
Thus $f(x_1) > f(x_2)$.
But $<$ is a trichotomous relation meaning it is not possible for
\textit{both} $f(x) = f(y)$ and $f(x) > f(y)$.
Thus our original assumption must be wrong.
\subparagraph{Conclusion}%
Since the above cases are exhaustive, the only possibility is $x_1 = x_2$.
Thus $f$ is one-to-one.
\paragraph{(ii)}%
Suppose $f(x) < f(y)$.
There are three cases to consider:
\subparagraph{Case 1}%
Assume $x < y$.
Then we are immediately finished.
\subparagraph{Case 2}%
Assume $x = y$.
Then $f(x) = f(y)$.
But $<$ is a trichotomous relation meaning it is not possible for
\textit{both} $f(x) = f(y)$ and $f(x) < f(y)$.
Thus our original assumption must be wrong.
\subparagraph{Case 3}%
Assume $x > y$.
By hypothesis, $f$ is monotonic.
Thus $f(x) > f(y)$.
But $<$ is a trichotomous relation meaning it is not possible for
\textit{both} $f(x) < f(y)$ and $f(x) > f(y)$.
Thus our original assumption must be wrong.
\subparagraph{Conclusion}%
Since the above cases are exhaustive, the only possibility is $x < y$.
\end{proof}
\subsection{\verified{Exercise 3.45}}%
\hyperlabel{sub:exercise-3.45}
Assume that $<_A$ and $<_B$ are linear orderings on $A$ and $B$, respectively.
Define the binary relation $<_L$ on the Cartesian product $A \times B$ by:
$$\pair{a_1, b_1} <_L \pair{a_2, b_2} \quad\text{iff}\quad
\text{either } a_1 <_A a_2 \text{ or } (a_1 = a_2 \land b_1 <_B b_2).$$
Show that $<_L$ is a linear ordering on $A \times B$.
(The relation $<_L$ is called \textit{lexicographic} ordering, being the
ordering used in making dictionaries.)
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_3}
{Enderton.Set.Chapter\_3.exercise\_3\_45}
We show that $<_L$ is (i) \nameref{ref:transitive} and (ii)
\nameref{ref:trichotomous} on $A \times B$.
\paragraph{(i)}%
Let $\pair{a_1, b_1} <_L \pair{a_2, b_2}$ and
$\pair{a_2, b_2} <_L \pair{a_3, b_3}$.
Then either $a_1 <_A a_2$ or $a_1 = a_2 \land b_1 <_B b_2$.
Likewise, either $a_2 <_A a_3$ or $a_2 = a_3 \land b_2 <_B b_3$.
We consider each combination of cases in turn:
\subparagraph{Case 1}%
Suppose $a_1 <_A a_2$ and $a_2 <_A a_3$.
Since $<_A$ is a linear ordering, it follows $<_A$ is transitive.
Thus $a_1 <_A a_3$.
Therefore $\pair{a_1, b_2} <_L \pair{a_3, b_3}$.
\subparagraph{Case 2}%
Suppose $a_1 <_A a_2$, $a_2 = a_3$, and $b_2 <_B b_3$.
Then $a_1 < a_3$.
Therefore $\pair{a_1, b_2} <_L \pair{a_3, b_3}$.
\subparagraph{Case 3}%
Suppose $a_1 = a_2$, $b_1 <_B b_2$, and $a_2 <_A a_3$.
Then $a_1 <_A a_3$.
Therefore $\pair{a_1, b_2} <_L \pair{a_3, b_3}$.
\subparagraph{Case 4}%
Suppose $a_1 = a_2$, $b_1 <_B b_2$, $a_2 = a_3$, and $b_2 <_B b_3$.
Then $a_1 = a_3$.
Since $<_B$ is a linear ordering, it follows $<_B$ is transitive.
Thus $b_1 <_B b_3$.
Therefore $\pair{a_1, b_2} <_L \pair{a_3, b_3}$.
\subparagraph{Conclusion}%
These four cases are exhaustive and each conclude that $<_L$ is
transitive.
\paragraph{(ii)}%
Let $\pair{a_1, b_1}, \pair{a_2, b_2} \in A \times B$.
Because $<_A$ and $<_B$ are linear orderings on $A$ and $B$ respectively,
it follows $<_A$ and $<_B$ are both trichotomous on their respective sets.
Thus exactly one of $$a_1 <_A a_2, \quad a_1 = a_2, \quad a_2 <_A a_1$$
and $$b_1 <_B b_2, \quad b_1 = b_2, \quad b_2 <_B b_1$$ holds.
There are three cases we examine:
\subparagraph{Case 1}%
\hyperlabel{spar:exercise-3.45-ii-case-1}
Suppose $a_1 <_A a_2$.
Then $\pair{a_1, b_1} <_L \pair{a_2, b_2}$.
This is trivially the only possible relationship between the ordered
pairs.
\subparagraph{Case 2}%
Suppose $a_1 = a_2$.
If $b_1 <_B b_2$, then $\pair{a_1, b_1} <_L \pair{a_2, b_2}$ is the only
possibility.
If $b_1 = b_2$, then $\pair{a_1, b_1} = \pair{a_2, b_2}$ is the only
possibility.
If $b_2 <_B b_1$, then $\pair{a_2, b_2} <_L \pair{a_1, b_1}$ is the only
possibility.
\subparagraph{Case 3}%
Suppose $a_2 <_A a_1$.
This case is analagous to \eqref{spar:exercise-3.45-ii-case-1}.
\subparagraph{Conclusion}%
In each of the above cases, we are always left with exactly one of
$$\pair{a_1, b_1} <_L \pair{a_2, b_2}, \quad
\pair{a_1, b_1} = \pair{a_2, b_2}, \quad
\pair{a_2, b_2} <_L \pair{a_1, b_1}.$$
Thus $<_L$ is trichotomous.
\end{proof}
\chapter{Natural Numbers}%
\hyperlabel{chap:natural-numbers}
\section{Inductive Sets}%
\hyperlabel{sec:inductive-sets}
\subsection{\unverified{Theorem 4A}}%
\hyperlabel{sub:theorem-4a}
\begin{theorem}[4A]
There is a set whose members are exactly the natural numbers.
\end{theorem}
\begin{proof}
By the \nameref{ref:infinity-axiom}, there exists an
\nameref{ref:inductive-set} $A$.
By the \nameref{ref:subset-axioms}, there exists a set $B$ such that
$$x \in B \iff x \in A \land \left[\forall C,
(\emptyset \in C \land
(\forall c \in C) c^+ \in C) \Rightarrow x \in C\right].$$
In other words, $x \in B$ if and only if $x \in A$ and $x$ is a natural
number.
Thus $B$ is the set whose members are exactly the natural numbers.
\end{proof}
\subsection{\unverified{Theorem 4B}}%
\hyperlabel{sub:theorem-4b}
\begin{theorem}[4B]
$\omega$ is inductive, and is a subset of every other inductive set.
\end{theorem}
\begin{proof}
$\omega$ denotes the set of \nameref{ref:natural-number}s.
We show $\omega$ is an \nameref{ref:inductive-set} by proving (i)
$\emptyset \in \omega$ and (ii) $\omega$ is closed under
\nameref{ref:successor}.
\paragraph{(i)}%
\hyperlabel{par:theorem-4b-i}
By definition, $\emptyset$ is a member of every inductive set.
Thus $\emptyset$ is a natural number, i.e. a member of $\omega$.
\paragraph{(ii)}%
\hyperlabel{par:theorem-4b-ii}
Let $n \in \omega$.
That is, let $n$ be a natural number.
By definition, $n$ is a member of every inductive set.
By definition of an inductive set, $n^+$ is then a member of every inductive
set as well.
Thus $n^+$ is a natural number, i.e. $n^+ \in \omega$.
\paragraph{Conclusion}%
By \nameref{par:theorem-4b-i} and \nameref{par:theorem-4b-ii}, it follows
$\omega$ is inductive.
It follows immediately from the definition of a natural number that $\omega$
is a subset of every other inductive set.
\end{proof}
\subsection{\verified{Theorem 4C}}%
\hyperlabel{sub:theorem-4c}
\begin{theorem}[4C]
Every natural number except $0$ is the successor of some natural number.
\end{theorem}
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_4}
{Enderton.Set.Chapter\_4.theorem\_4c}
Let $T = \{n \mid n = 0 \lor (\exists m) n = m^+\}$.
It trivially follows that $\emptyset \in T$.
Let $x \in T$.
Then $x^+ \in T$ since $(\exists m) x^+ = m^+$, namely $m = x$.
Therefore $T$ is inductive.
By \nameref{sub:theorem-4b}, $\omega$ is a subset of $T$.
Thus every natural number satisfies the condition written in $T$'s definition.
In other words, every natural number except $0$ is the successor of some
natural number.
\end{proof}
\section{Peano's Postulates}%
\hyperlabel{sec:peanos-postulates}
\subsection{\verified{Theorem 4D}}%
\hyperlabel{sub:theorem-4d}
\begin{theorem}[4D]
$\langle \omega, \sigma, 0 \rangle$ is a Peano system.
\end{theorem}
\begin{proof}
\lean{Common/Set/Peano}{Peano.instSystemNatUnivSuccOfNatInstOfNatNat}
Note $\sigma$ is defined as $\sigma = \{\pair{n, n^+} \mid n \in \omega\}$.
To prove $\langle \omega, \sigma, 0 \rangle$ is a \nameref{ref:peano-system},
we must show that (i) $0 \not\in \ran{S}$, (ii) $\sigma$ is one-to-one, and
(iii) every subset $A$ of $\omega$ containing $0$ and closed under $\sigma$
is $\omega$ itself.
\paragraph{(i)}%
This follows immediately from \nameref{sub:theorem-4c}.
\paragraph{(ii)}%
Let $n^+ \in \ran{\sigma}$.
By construction, there exists some $m_1 \in \omega$ such that $m_1 = n^+$.
Suppose there exists some $m_2 \in \omega$ such that $m_2 = n^+$.
By definition of the \nameref{ref:successor}, $m_1 = n \cup \{n\} = m_2$.
By the \nameref{ref:extensionality-axiom}, $m_1 = m_2$.
Thus $\sigma$ is one-to-one.
\paragraph{(iii)}%
This follows immediately from \nameref{sub:theorem-4b}.
\end{proof}
\subsection{\unverified{Theorem 4E}}%
\hyperlabel{sub:theorem-4e}
\begin{theorem}[4E]
For a transitive set $a$, $$\bigcup \left(a^+\right) = a.$$
\end{theorem}
\begin{proof}
Let $a$ be a \nameref{ref:transitive-set}.
We show that
\begin{equation}
\hyperlabel{sub:theorem-4e-eq1}
x \in \bigcup \left(a^+\right) \iff x \in a.
\end{equation}
\paragraph{($\Rightarrow$)}%
Suppose $x \in \bigcup \left(a^+\right)$.
By definition of \nameref{ref:successor},
$x \in \bigcup \left(a \cup \{a\}\right)$.
Then there exists some $b \in a \cup \{a\}$ such that $x \in b$.
There are two cases to consider:
\subparagraph{Case 1}%
Suppose $b \in a$.
By definition of a transitive set, $x \in b \in a$ means $x \in a$.
\subparagraph{Case 2}%
Suppose $b \in \{a\}$.
Then $b = a$ and immediately $x \in b = a$.
\paragraph{($\Leftarrow$)}%
Suppose $x \in a$.
Then immediately $x \in a \cup \{a\}$.
Thus there exists some $b$ such that $b \in a \cup \{a\}$ and $x \in b$,
namely $b = \{a\}$.
Thus $x \in \bigcup \left(a^+\right)$.
\paragraph{Conclusion}%
We have shown both sides of \eqref{sub:theorem-4e-eq1} holds.
By the \nameref{ref:extensionality-axiom}, $\bigcup \left(a^+\right) = a$.
\end{proof}
\subsection{\unverified{Theorem 4F}}%
\hyperlabel{sub:theorem-4f}
\begin{theorem}[4F]
Every natural number is a transitive set.
\end{theorem}
\begin{proof}
Let $T = \{n \in \omega \mid n \text{ is a transitive set}\}$.
We (i) prove that $T$ is an \nameref{ref:inductive-set} and then (ii) every
natural number is a transitive set.
\paragraph{(i)}%
\label{par:theorem-4f-i}
First, $\emptyset \in T$ since it vacuously holds that a member of a
member of $\emptyset$ is itself a member of $\emptyset$.
Next, let $n \in T$ and consider whether $n^+ \in T$.
Since $n$ is a transitive set, \nameref{sub:theorem-4e} implies
$\bigcup \left(n^+\right) = n$.
But $n \subseteq n^+ = n \cup \{n\}$.
Thus $\bigcup \left(n^+\right) \subseteq n+$, i.e. $n^+$ is a transitive
set.
Therefore $n^+ \in T$.
Hence $T$ is inductive.
\paragraph{(ii)}%
Notice $T \subseteq \omega$.
By \nameref{par:theorem-4f-i} and \nameref{sub:theorem-4b}, $T = \omega$.
Thus every natural number is a transitive set.
\end{proof}
\subsection{\unverified{Theorem 4G}}%
\label{sub:theorem-4g}
\begin{theorem}[4G]
The set $\omega$ is a transitive set.
\end{theorem}
\begin{proof}
Let $T = \{n \in \omega \mid \forall t \in n, t \in \omega\}$.
We prove that (i) $T$ is an \nameref{ref:inductive-set} and then (ii) every
member of a natural number is itself a natural number.
\paragraph{(i)}%
\label{par:theorem-4g-i}
First, it vacuously holds that $\emptyset \in T$.
Next, let $n \in T$.
We must prove that $n^+ \in T$ as well.
By definition of the \nameref{ref:successor}, $n^+ = n \cup \{n\}$.
That is, either $n^+ = n$ or $n^+ = \{n\}$.
If the former, then every member of $n^+$ must be a natural number since
this already holds for $n$.
If the latter, the only member of $n^+$ is $n$ which is, by definition of
$T$, a natural number.
Thus $n^+ \in T$.
We conclude that $T$ is an inductive set.
\paragraph{(ii)}%
Since $T \subseteq \omega$, \nameref{par:theorem-4g-i} and
\nameref{sub:theorem-4b} implies $T = \omega$.
Thus the member of every natural number is itself a natural number.
In other words, $\bigcup \omega \subseteq \omega$.
Therefore $\omega$ is indeed a \nameref{ref:transitive-set}.
\end{proof}
\section{Exercises 4}%
\hyperlabel{sec:exercises-4}
\subsection{\verified{Exercise 4.1}}%
\hyperlabel{sub:exercise-4.1}
Show that $1 \neq 3$ i.e., that $\emptyset^+ \neq \emptyset^{+++}$.
\begin{proof}
\lean{Bookshelf/Enderton/Set/Chapter\_4}
{Enderton.Set.Chapter\_4.exercise\_4\_1}
By definition,
\begin{align*}
1 & = \{\emptyset\} \\
3 & = \{\emptyset, \{\emptyset\}, \{\emptyset, \{\emptyset\}\}\}.
\end{align*}
By the \nameref{ref:extensionality-axiom}, these two sets are trivially not
equal to one another.
\end{proof}
\subsection{\unverified{Exercise 4.2}}%
\hyperlabel{sub:exercise-4.2}
Show that if $a$ is a transitive set, then $a^+$ is also a transitive set.
\begin{proof}
Suppose $a$ is a \nameref{ref:transitive-set}.
By \nameref{sub:theorem-4e}, it follows $\bigcup \left(a^+\right) = a$.
By definition of a \nameref{ref:successor}, $a^+ = a \cup \{a\}$.
Thus it immediately follows
$$\bigcup \left(a^+\right) = a \subseteq a \cup \{a\} = a^+.$$
Therefore $a^+$ is indeed a transitive set.
\end{proof}
\subsection{\unverified{Exercise 4.3}}%
\hyperlabel{sub:exercise-4.3}
\begin{enumerate}[(a)]
\item Show that if $a$ is a transitive set, then $\powerset{a}$ is also a
transitive set.
\item Show that if $\powerset{a}$ is a transitive set, then $a$ is also a
transitive set.
\end{enumerate}
\begin{proof}
\paragraph{(a)}%
Suppose $a$ is a \nameref{ref:transitive-set}.
We show that $\bigcup \powerset{a} \subseteq \powerset{a}$.
Let $t \in \bigcup \powerset{a}$.
By definition of the \nameref{ref:power-set}, there exists some
$X \subseteq a$ such that $t \in X$.
Thus $t \in a$.
Because $a$ is a transitive set, every member of $t$ is a member of $a$.
In other words, $t \subseteq a$.
Equivalently, $t \in \powerset{a}$.
\paragraph{(b)}%
Suppose $\powerset{a}$ is a transitive set.
We show that $\bigcup a \subseteq a$.
Let $t \in \bigcup a$.
Then there exists some $b \in a$ such that $t \in b$.
Since $\{b\}$ is a member of $\powerset{a}$ and $\powerset{a}$ is a
transitive set, $b \in \powerset{a}$.
That is, $b \subseteq a$.
Thus $t \in a$.
\end{proof}
\subsection{\unverified{Exercise 4.4}}%
\hyperlabel{sub:exercise-4.4}
Show that if $a$ is a transitive set, then $\bigcup a$ is also a transitive set.
\begin{proof}
Suppose $a$ is a transitive set.
We show that $\bigcup\bigcup{a} \subseteq \bigcup a$.
Let $t \in \bigcup\bigcup{a}$.
Then there exists some $b \in \bigcup{a}$ such that $t \in b$.
Since $a$ is transitive, $\bigcup{a} \subseteq a$.
Thus $b \in a$ and $t \in \bigcup a$.
\end{proof}
\subsection{\unverified{Exercise 4.5}}%
\hyperlabel{sub:exercise-4.5}
Assume that every member of $\mathscr{A}$ is a transitive set.
\begin{enumerate}[(a)]
\item Show that $\bigcup\mathscr{A}$ is a transitive set.
\item Show that $\bigcap\mathscr{A}$ is a transitive set (assume that
$\mathscr{A}$ is nonempty).
\end{enumerate}
\begin{proof}
\paragraph{(a)}%
Suppose every member of $\mathscr{A}$ is a transitive set.
We show that $\bigcup\bigcup{\mathscr{A}} \subseteq \bigcup{\mathscr{A}}$.
Let $t \in \bigcup\bigcup{\mathscr{A}}$.
Then there exists some $b_1 \in \bigcup{\mathscr{A}}$ such that $t \in b_1$.
Likewise there exists some $b_2 \in \mathscr{A}$ such that $b_1 \in b_2$.
By hypothesis, $b_2$ is transitive meaning $t \in b_2$.
Thus $t \in \bigcup{\mathscr{A}}$.
\paragraph{(b)}%
Suppose every member of nonempty set $\mathscr{A}$ is a transitive set.
We show that $\bigcup\bigcap{\mathscr{A}} \subseteq \bigcap{\mathscr{A}}$.
Let $t \in \bigcup\bigcap{\mathscr{A}}$.
Then there exists some $b \in \bigcap{\mathscr{A}}$ such that $t \in b$.
Thus $b$ is a member of every member of $\mathscr{A}$.
By hypothesis, every member of $\mathscr{A}$ is a transitive set meaning
$t$ must be a member of every member of $\mathscr{A}$.
In other words, $t \in \bigcap{\mathscr{A}}$.
\end{proof}
\subsection{\unverified{Exercise 4.6}}%
\hyperlabel{sub:exercise-4.6}
Prove the converse to \nameref{sub:theorem-4e}: If
$\bigcup \left(a^+\right) = a$, then $a$ is a transitive set.
\begin{proof}
Let $a$ be a set such that $\bigcup \left(a^+\right) = a$.
Then
\begin{align*}
\bigcup \left(a^+\right)
& = \bigcup (a \cup \{a\}) & \textref{ref:successor} \\
& = \bigcup a \cup \bigcup \{a\} & \textref{sub:exercise-2.21} \\
& = a. & \text{by hypothesis}
\end{align*}
But $$\bigcup{a} \subseteq \bigcup a \cup \bigcup \{a\} = a.$$
Thus $a$ is indeed a \nameref{ref:transitive-set}.
\end{proof}
\end{document}