theorem exercise_31_3 {α : Type*} [partial_order α]
  [topological_space α] (h : order_topology α) : regular_space α :=

Show that every order topology is regular.

\begin{proof}

    Let $X$ be an ordered set.

First we show that $X$ is a $T_1$-space. For $x \in X$ we have that

$$

X \backslash\{x\}=\langle-\infty, x\rangle \cup\langle x,+\infty\rangle

$$

which is an open set as an union of two open intervals. Therefore, the set $\{x\}$ is closed.

Step 2

2 of 3

Now to prove that $X$ is regular we use Lemma $\mathbf{3 1 . 1 .}$

Let $x \in X$ be any point and $U \subseteq X$ any open neighborhood of $x$. Then there exist $a, b \in X$ such that $x \in\langle a, b\rangle \subseteq U$. Now we have four possibilities.

1. If there exist $x_1, x_2 \in U$ such that $a<x_1<x<x_2<b$, then

$$

x \in\left\langle x_1, x_2\right\rangle \subseteq \overline{\left\langle x_1, x_2\right\rangle} \subseteq\left[x_1, x_2\right] \subseteq\langle a, b\rangle \subseteq U

$$

2. If there exists $x_1 \in U$ such that $a<x_1<x$, but there's no $x_2 \in U$ such that $x<x_2<b$, then

$$

x \in\left\langle x_1, b\right\rangle=\left(x_1, x\right] \subseteq \overline{\left(x_1, x\right]} \subseteq\left[x_1, x\right] \subseteq\langle a, b\rangle \subseteq U

$$

3. If there exists $x_2 \in U$ such that $x<x_2<b$, but there's no $x_1 \in U$ such that $a<x_1<x$, then

$$

x \in\left\langle a, x_2\right\rangle=\left[x, x_2\right) \subseteq \overline{\left[x, x_2\right)} \subseteq\left[x, x_2\right] \subseteq\langle a, b\rangle \subseteq U

$$

4. If there's no $x_1 \in U$ such that $a<x_1<x$ and no $x_2 \in U$ such that $x<x_2<b$, then

$$

x \in\langle a, b\rangle=\{x\}=\overline{\{x\}}=\{x\} \subseteq U

$$

We have that $\overline{\{x\}}=\{x\}$ because $X$ is a $T_1$-space.

In all four cases we proved that there exists an open interval $V$ such that $x \in V \subseteq \bar{V} \subseteq U$, so $X$ is regular.

\end{proof}


theorem exercise_32_2a
  {ι : Type*} {X : ι → Type*} [∀ i, topological_space (X i)]
  (h : ∀ i, nonempty (X i)) (h2 : t2_space (Π i, X i)) :
  ∀ i, t2_space (X i) :=

import .common

open set topological_space filter
open_locale classical topology filter
noncomputable theory

Show that if $\prod X_\alpha$ is Hausdorff, then so is $X_\alpha$. Assume that each $X_\alpha$ is nonempty.

\begin{proof}

    Suppose that $X=\prod_\beta X_\beta$ is Hausdorff and let $\alpha$ be any index.

Let $x, y \in X_\alpha$ be any points such that $x \neq y$. Since all $X_\beta$ are nonempty, there exist points $\mathbf{x}, \mathbf{y} \in X$ such that $x_\beta=y_\beta$ for every $\beta \neq \alpha$ and $x_\alpha=x, y_\alpha=y$.

Since $x \neq y$, it follows that $\mathbf{x} \neq \mathbf{y}$. Since $X$ is Hausdorff, there exist open disjoint sets $U, V \subseteq X$ such that $\mathbf{x} \in U$ and $\mathbf{y} \in V$.

For $\beta \neq \alpha$ we have that $x_\beta=y_\beta \in \pi_\beta(U) \cap \pi_\beta(V)$, hence $\pi_\beta(U)$ and $\pi_\beta(V)$ are not disjoint.

Since $U$ and $V$ are disjoint, it follows that $\pi_\alpha(U) \cap \pi_\alpha(V)=\emptyset$.

We also have that $x \in \pi_\alpha(U)$ and $y \in \pi_\alpha(V)$ and since the projections are open maps, it follows that the sets $\pi_\alpha(U)$ and $\pi_\alpha(V)$ are open.

This proves that $x$ and $y$ can be separated by open sets, so $X_\alpha$ is Hausdorff.

\end{proof}


theorem exercise_32_2c
  {ι : Type*} {X : ι → Type*} [∀ i, topological_space (X i)]
  (h : ∀ i, nonempty (X i)) (h2 : normal_space (Π i, X i)) :
  ∀ i, normal_space (X i) :=

Show that if $\prod X_\alpha$ is normal, then so is $X_\alpha$. Assume that each $X_\alpha$ is nonempty.

\begin{proof}

    Suppose that $X=\prod_\beta X_\beta$ is normal and let $\alpha$ be any index.

Since $X$ is normal, it follows that $X$ is Hausdorff (or regular), which then implies that $X_\alpha$ is Hausdorff (or regular). This imples that $X_\alpha$ satisfies the $T_1$ axiom.

Now the proof that $X_\alpha$ satisfies the $T_4$ axiom is the same as for regular spaces.

If $F, G \subseteq X_\alpha$ are disjoint closed sets, then $\prod_\beta F_\beta$ and $\prod_\beta G_\beta$, where $F_\alpha=F, G_\alpha=G$ and $F_\beta=G_\beta=X_\beta$ for $\beta \neq \alpha$, are disjoint closed sets in $X$.

Since $X$ is normal (and therefore satisfies the $T_4$ axiom), there exist disjoint open sets $U, V \subseteq X$ such that $\prod_\beta F_\beta \subseteq U$ and $\prod_\beta G_\beta \subseteq V$

Then $\pi_\alpha(U)$ and $\pi_\alpha(V)$ are disjoint open sets in $X_\alpha$ such that $F \subseteq \pi_\alpha(U)$ and $G \subseteq \pi_\alpha(V)$.

\end{proof}


theorem exercise_33_7 {X : Type*} [topological_space X]
  (hX : locally_compact_space X) (hX' : t2_space X) :
  ∀ x A, is_closed A ∧ ¬ x ∈ A →
  ∃ (f : X → I), continuous f ∧ f x = 1 ∧ f '' A = {0}
  :=

Show that every locally compact Hausdorff space is completely regular.

\begin{proof}

    $X$ is a subspace of a compact Hausdorff space $Y$, its one-point compactification. $Y$ is normal, and so by the Urysohn lemma $Y$ is completely regular. Therefore by corollary $X$ is completely regular.

\end{proof}


theorem exercise_34_9
  (X : Type*) [topological_space X] [compact_space X]
  (X1 X2 : set X) (hX1 : is_closed X1) (hX2 : is_closed X2)
  (hX : X1 ∪ X2 = univ) (hX1m : metrizable_space X1)
  (hX2m : metrizable_space X2) : metrizable_space X :=

Let $X$ be a compact Hausdorff space that is the union of the closed subspaces $X_1$ and $X_2$. If $X_1$ and $X_2$ are metrizable, show that $X$ is metrizable.

\begin{proof}

    Both $X_1$ and $X_2$ are compact, Hausdorff and metrizable, so by exercise 3 they are second countable, i.e. there are countable bases $\left\{U_{i, n} \subset X_i \mid n \in \mathbb{N}\right\}$ for $i \in\{1,2\}$. By the same exercise it is enough to show that $X$ is second countable. If $X_1 \cap X_2=\emptyset$ both $X_1$ and $X_2$ are open and the union $\left\{U_{i, n} \mid i \in\{1,2\} ; n \in \mathbb{N}\right\}$ of their countable bases form a countable base for $X$.

Suppose now $X_1 \cap X_2 \neq \emptyset$. Let $x \in X$ and $U \subset X$ be an open neighborhood of $x$. If $x \in X_i-X_j=X-$ $X_j$ then $U \cap X_i$ is open in $X_i$ and there is a basis neighborhood $U_{i, n}$ of $x$ such that $x \in U_{i, n} \cap X-X_j$ is an open neighborhood of $x$ in the open subset $X-X_j$, so $U_{i, n} \cap X-X_j$ is also open in $X$.

Suppose now that $x \in X_1 \cap X_2$. We have that $U \cap X_i$ is open in $X_i$ so there is a basis neighborhood $U_{i, n_i}$ contained in $U \cap X_i$. By definition of sub-space topology there is some open subset $V_{i, n_i} \subset X$ such that $U_{i, n_i}=$ $X_i \cap V_{i, n_i}$. Then

$$

x \in V_{1, n_1} \cap V_{2, n_2}=\left(V_{1, n_1} \cap V_{2, n_2} \cap X_1\right) \cup\left(V_{1, n_1} \cap V_{2, n_2} \cap X_2\right)=\left(U_{1, n_1} \cap V_{2, n_2}\right) \cup\left(V_{1, n_1} \cap U_{2, n_2}\right) \subset U

$$

Therefore the open subsets $U_{i, n} \cap X-X_j$ and $V_{1, n_1} \cap V_{2, n_2}$ form a countable base for $X$.

\end{proof}


theorem exercise_43_2 {X : Type*} [metric_space X]
  {Y : Type*} [metric_space Y] [complete_space Y] (A : set X)
  (f : X → Y) (hf : uniform_continuous_on f A) :
  ∃! (g : X → Y), continuous_on g (closure A) ∧
  uniform_continuous_on g (closure A) ∧ ∀ (x : A), g x = f x :=

Let $(X, d_X)$ and $(Y, d_Y)$ be metric spaces; let $Y$ be complete. Let $A \subset X$. Show that if $f \colon A \rightarrow Y$ is uniformly continuous, then $f$ can be uniquely extended to a continuous function $g \colon \bar{A} \rightarrow Y$, and $g$ is uniformly continuous.

\begin{proof}

    Let $\left(X, d_X\right)$ and $\left(Y, d_Y\right)$ be metric spaces; let $Y$ be complete. Let $A \subset X$. It is also given that $f: A \longrightarrow X$ is a uniformly continuous function. Then we have to show that $f$ can be uniquely extended to a continuous function $g: \bar{A} \longrightarrow Y$, and $g$ is uniformly coninuous.

We define the function $g$ as follows:

$$

g(x)= \begin{cases}f(x) & \text { if } x \in A \\ \lim _{n \rightarrow \infty} f\left(x_n\right) & \text { if } x \in \bar{A},\end{cases}

$$

where $\left\{x_n\right\} \subset A$ is some sequence in $A$ such that $\lim _{n \rightarrow \infty} x_n=x$. Now we have to check that the above definition is well defined. We first note that since $\left\{x_n\right\} \subset A$ is convergent in $X,\left\{x_n\right\}$ is Cauchy in $A$ and since $f$ is uniformly continuous on $A,\left\{f\left(x_n\right)\right\}$ is Cauchy in $Y$. Further, since $Y$ is complete $\left\{f\left(x_n\right)\right\}$ is convergent. So let us now consider two sequences $\left\{x_n\right\}$ and $\left\{y_n\right\}$ such that $\lim _{n \rightarrow \infty} x_n=\lim _{n \rightarrow \infty} y_n=x$. Then we need to prove that $\lim _{n \rightarrow \infty} f\left(x_n\right)=\lim _{n \rightarrow \infty} f\left(y_n\right)=f(x)$. Let

$$

\lim _{n \rightarrow \infty} f\left(x_n\right)=a \text { and } b=\lim _{n \rightarrow \infty} f\left(y_n\right)

$$

Now since $f$ is uniformly continuous for any given $\epsilon>0$ there exists $\delta>0$ such that

$$

d_Y(f(x), f(y))<\epsilon \text { whenever } d_X(x, y)<\delta \text { and } x, y \in A

$$

So for this $\delta>0$ there exists $N \in \mathbb{N}$ such that

$$

d_X\left(x_n, x\right)<\frac{\delta}{2} \text { and } d_X\left(y_n, x\right)<\frac{\delta}{2}, \text { foe all } n \geq N .

$$

Therefore, we have that for all $n \geq N$,

$$

d_X\left(x_n, y_n\right)<\delta

$$

Thus the equation (1) yields us that

$$

d_Y\left(f\left(x_n\right), f\left(y_n\right)\right)<\epsilon \text { for all } n \geq N .

$$

Now since $\lim _{n \rightarrow \infty} f\left(x_n\right)=a$ and $b=\lim _{n \rightarrow \infty} f\left(y_n\right)$, so for the above $\epsilon>0$ we have a natural number $K \geq N$ such that

$$

\begin{gathered}

d_Y\left(f\left(x_n\right), a\right)<\epsilon \text { for all } n \geq K \text { and } \\

d_Y\left(f\left(y_n\right), b\right)<\epsilon \text { for all } n \geq K .

\end{gathered}

$$

Moreover, since $K \geq N$, from $(2)$ we get

$$

d_Y\left(f\left(x_n\right), f\left(y_n\right)\right)<\epsilon \text { for all } n \geq K .

$$

Now we calculate the following, for $n \geq K$,

$$

\begin{array}{rlr}

d_Y(a, b) & \leq & d_Y\left(a, f\left(x_n\right)\right)+d_Y\left(f\left(x_n\right), f\left(y_n\right)\right)+d\left(f\left(y_n\right), b\right) \\

& < & \epsilon+\epsilon+\epsilon \text { by }(3),(4) \text { and }(5) \\

& = & 3 \epsilon

\end{array}

$$

where the first inequality holds because of triangular inequality. Since $\epsilon>0$ is arbitrary the above calculation shows that $d_Y(a, b)=0$. Thus, the above definition is independent of the choice of the sequence $\left\{x_n\right\}$ and hence the map $g$ is well defined. Moreover, from the construction it follows that $g$ is continuous on $\bar{A}$.

Moreover, we observe that $g$ is unique extension of $f$ by the construction.

So it remains to show that $g$ is uniformly continuous. In order to that we take a Cauchy sequence $\left\{a_n\right\} \subset \bar{A}$. Then since $\bar{A}$ is a closed set so the sequence $\left\{a_n\right\}$ is convergent and hence $\left\{g\left(a_n\right)\right\}$ is also a convergent sequence as $g$ is continuous on $\bar{A}$. So $\left\{g\left(a_n\right)\right\}$ is a Cauchy sequence in $Y$. Since a function is uniformly continuous if and only if it sends Cauchy sequences to Cauchy sequences, we conclude that $g$ is uniformly continuous.

\end{proof}