\documentclass{article}

\usepackage[english]{babel}
\usepackage[margin=1in]{geometry}

\usepackage{amsmath}
% for symbols such as /implies
\usepackage{amssymb}
% for symbols such as /subsetneq
\usepackage{amsthm}
% for commands such as \newtheorem

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}
\newtheorem{axiom}{Axiom}

\begin{document}

\section{Metric Spaces}

% metric space
\begin{definition}
  A \emph{metric} on a set $X$ is a function $d: X\times X \to \mathbb{R}$ such that
  \begin{enumerate}
    \item For all $x,y\in X$, one has $d(x,y)=0$ if and only if $x=y$.
    \item For all $x,y\in X$, one has $d(y,x)=d(x,y)$.
    \item For all $x,y,z\in X$, one has $d(x,z)\leq d(x,y)+d(y,z)$.
  \end{enumerate}
  If $d$ is a metric on $X$, we call $(X,d)$ a \emph{metric space}. We may occasionaly say $X$ is a metric space with metric $d$.
\end{definition}

\begin{theorem}
  If $X$ is a metric space with metric $d$, then for all $x,y\in X$ one has $d(x,y)\geq 0$.
  \begin{proof}
    Let $X$ be a metric space with metric $d$ and let $x,y\in X$. Then
    $$
      0 = d(x,x) \leq d(x,y) + d(y,x) = 2d(x,y)
    $$
    and it follows that $0\leq d(x,y)$.
  \end{proof}
\end{theorem}

% isometric embedding / isometry
\begin{definition}
  Let $X$ and $Y$ be metric spaces with metrics $d_X$ and $d_Y$ respectively. A function $f:X\to Y$ is an \emph{isometric embedding} if for all $x_1,x_2\in X$
  $$
    d_Y(f(x_1), f(x_2)) = d_X(x_1, x_2)
  $$
  An \emph{isometry} is a bijective isometric embedding.
\end{definition}

\begin{theorem}
  An isometric embedding is injective.
  \begin{proof}
    Let $X$ and $Y$ be metric spaces with metrics $d_X$ and $d_Y$ respectively. Let $f:X\to Y$ be an isometric embedding. Suppose $f(x_1)=f(x_2)$.
    Then
    $$
      0 = d_Y(f(x_1), f(x_2)) = d_X(x_1, x_2)
    $$
    and it follows that $x_1 = x_2$. Hence $f$ is injective.
  \end{proof}
\end{theorem}

% balls
\begin{definition}
  Let $X$ be a metric space with metric $d$. Given $x\in X$ and $r > 0$, the \emph{ball} of radius $r$ centered at $x$ is the set
  $$
    B_r(x) = \{y\in X : d(x,y) < r\}
  $$
\end{definition}

% open set
\begin{definition}
  Let $(X,d)$ be a metric space. A subset $U\subseteq X$ is an \emph{open set} with respect to $d$ if for each $x\in U$, there is $r> 0$ such that $B_r(x)\subseteq U$.
\end{definition}

\begin{theorem}
  Let $(X,d)$ be a metric space. For each $x\in X$ and $r> 0$, the ball $B_r(x)$ is an open set with respect to $d$.
  \begin{proof}
    Let $x\in X$ and $r>0$. Let $y\in B_r(x)$. Then $d(x,y) < r$. Let $R = r - d(x,y) > 0$. Let $u\in B_R(y)$. Then
    $$
      d(x,u) \leq d(x,y) + d(y,u) < d(x,y) + R = r
    $$
    and so $u\in B_r(x)$. It follows that $B_R(y)\subseteq B_r(x)$. Hence $B_r(x)$ is an open set with respect to $d$.
  \end{proof}
\end{theorem}

\begin{theorem}
  Let $(X,d)$ be a metric space. Let $\mathcal{B} = \{B_r(x) : x\in X,\ r>0\}$. Then $\mathcal{B}$ is a basis for a topology on $X$.
  \begin{proof}
    Let $x\in X$. Then $x\in B_1(x)\in \mathcal{B}$. Suppose there are $B_1,B_2\in\mathcal{B}$ with $x\in B_1\cap B_2$. Then there are $a,b\in X$ and $r,s>0$ with $B_1=B_r(a)$ and $B_2=B_s(b)$. Then $d(x,a)<r$ and $d(x,b)<s$. Let $t=\min\{r-d(x,a), s-d(x,b)\}$. Since $r>0$ and $s>0$, we have $t>0$.
    Let $B = B_t(x)$. Then $B\in\mathcal{B}$.
    Let $y\in B$. Then $d(x,y)<t$. Hence 
    $$
      d(a,y) \leq d(a,x) + d(x,y) < r
    $$ 
    and 
    $$
      d(b,y) \leq d(b,x) + d(x,y) < s.
    $$
    Then $y\in B_1\cap B_2$ and consequently $x\in B\subseteq B_1\cap B_2$. Then $\mathcal{B}$ is a basis for a topology on $X$.
  \end{proof}
\end{theorem}

\begin{theorem}
  Let $(X,d)$ be a metric space. Let $\mathcal{B} = \{B_r(x) : x\in X,\ r>0\}$. Then $U\in\tau_\mathcal{B}$ if and only if $U\subseteq X$ is an open set with respect to $d$.
  \begin{proof}
    Suppose $U\in\tau_\mathcal{B}$. If $U$ is empty, it vacuously follows that $U$ is an open set. Suppose $U$ is nonempty and let $x\in U$. Then there is $B\in\mathcal{B}$ such that $x\in B\subseteq U$. Moreover, there is $a\in X$ and $r>0$ such that $B=B_r(a)$. If $a=x$, then $U$ is an open set. Suppose $a\neq x$. Then $d(a,x) > 0$. Let $s=r-d(a,x)$. Since $x\in B$, we have $d(a,x)<r$ and so $s>0$. If $d(x,y)<s$, then 
    $$
      d(a,y) \leq d(a,x) + d(x,y) < r.
    $$
    It follows that $x\in B_s(x) \subseteq B_r(a) = B \subseteq U$. Hence $U$ is an open set with respect to $d$.

    Suppose $V\subseteq X$ is an open set with respect to $d$. Let $x\in V$. Then there is $r>0$ such that $B_r(x)\subseteq V$. Let $B = B_r(x)$. Then $B\in\mathcal{B}$ and $x\in B\subseteq V$. Hence $V\in\tau_\mathcal{B}$.
  \end{proof}
\end{theorem}

It follows that there is no ambiguity by referring to an open set with respect to $d$ as, simply, an open set.

\begin{theorem}
  Let $(X,d)$ be a metric space. Let $\mathcal{B} = \{B_r(x) : x\in X,\ r>0\}$. Then $(X, \tau_\mathcal{B})$ is Hausdorff.
  \begin{proof}
    Let $x,y\in X$ with $x\neq y$. Then $d(x,y)>0$. Let $r=d(x,y)/2$. Then $r>0$. Let $U=B_r(x)$ and $V=B_r(y)$. Then $U,V\in\mathcal{B}$ so that $U,V\in\tau_\mathcal{B}$. If $a\in U$, then $d(a,x)<r$ and
    $$
      d(a,y) \geq d(x,y) - d(a,x) > d(x,y) - r = r
    $$
    so that $a\notin V$. If $b\in V$, then $d(b,y) < r$ and
    $$
      d(b,x) \geq d(x,y) - d(b,y) > d(x,y) - r = r
    $$
    so that $b\notin U$. Then $x\in U$, $y\in V$, and $U\cap V=\emptyset$. It follows that $(X,\tau_\mathcal{B})$ is Hausdorff.
  \end{proof}
\end{theorem}

% metrizable
\begin{definition}
  Let $(X,\tau)$ be a topological space. If there is a metric $d$ such that $(X,d)$ is a metric space, then $(X,\tau)$ is \emph{metrizable}.
\end{definition}

\begin{example}
  If $X$ is an infinite set with the finite complement topology, then $X$ is not metrizable.
  \begin{proof}
    Let $X$ be an infinite set with the finite complement topology. Then $X$ is not Hausdorff. Hence $X$ is not metrizable.
  \end{proof}
\end{example}

% closure/interior/boundary
\begin{definition}
  Let $X$ be a metric space. Let $A\subseteq X$. The \emph{closure} of a $A$, denoted $\overline{A}$, is the intersection of all closed sets containing $A$.
  The \emph{interior} of $A$, denoted $\text{int}A$, is the union of all open sets contained in $A$.
  The \emph{boundary} of $A$, denoted $\text{bd}A$, is the set $\overline{A}\setminus\text{int}A$.
\end{definition}

% continuous
\begin{definition}
  Let $X$ and $Y$ be metric spaces. A function $f:X\to Y$ is \emph{continuous} at $x\in X$ if for all $\varepsilon > 0$ there is $\delta > 0$ so that $s\in B_\delta(x) \implies f(s) \in B_\varepsilon(f(x))$.
  We say $f$ is \emph{continuous} if it is continuous at each $x\in X$.
\end{definition}

% convergence
\begin{definition}
  Let $X$ be a metric space. A sequence $(x_n)_{n=1}^\infty \subseteq X$ \emph{converges} to $x\in X$ if for all $\varepsilon > 0$ there is $N\in\mathbb{N}$ such that $n\geq N \implies x_n \in B_\varepsilon(x)$. We denote $(x_n)$ converges to $x$ by $\lim x_n = x$ or $x_n \to x$.
\end{definition}

% sequential continuity
\begin{definition}
  Let $X$ and $Y$ be metric spaces. A function $f:X\to Y$ is \emph{sequentially continuous} if whenever $(x_n)_{n=1}^\infty \subseteq X$ is a sequence converging to $x\in X$, it follows that $\lim f(x_n) = f(x)$.
\end{definition}
    
\begin{theorem}
  Let $X$ and $Y$ be metric spaces. Let $f:X\to Y$ be a function. The following are equivalent.
  \begin{enumerate}
    \item $f$ is continuous.
    \item $f$ is sequentially continuous.
    \item For any open set $V\subseteq Y$, the set $f^{-1}(V)$ is open in $X$.
    \item For any set $A\subseteq X$, one has $f(\overline{A}) \subseteq \overline{f(A)}$.
  \end{enumerate}
\end{theorem}

\end{document}