\section{Measurable Functions into Metric Spaces}
\label{section:measurable-metric}

\begin{proposition}
\label{proposition:metric-measurable-fibre-product}
    Let $(X, \cm)$, $(Z, \cn)$ be measurable spaces, $\seqf{Y_j}$ separable metrisable topological spaces, $F: \prod_{j = 1}^n Y_j \to Z$ be a $(\cb_{\prod_{j = 1}^n Y_j}, \cn)$-measurable function. For any $\seqf{f_j}$ where for each $1 \le j \le n$, $f_j: X \to Y_j$ is $(\cm, \cb_{Y_j})$-measurable, the composition
    \[
    X \to Z \quad x \mapsto F(f_1(x), \cdots, f_n(x))
    \]

    is $(\cm, \cn)$-measurable.
\end{proposition}
\begin{proof}
    By \autoref{proposition:product-sigma-algebra-metric}, $\cb_{\prod_{j = 1}^n Y_j} = \bigotimes_{j = 1}^n \cb_{Y_j}$, so
    \[
    X \to \prod_{j = 1}^n Y_j \quad x \mapsto (f_1(x), \cdots, f_n(x))
    \]

    is $(\cm, \cb_{\prod_{j = 1}^n Y_j})$-measurable. Therefore the composition is $(\cm, \cn)$-measurable.
\end{proof}

\begin{proposition}
\label{proposition:metric-measurables}
    Let $(X, \cm)$ be a measurable space, $Y$ be a metrisable topological space, $f, g: X \to Y$ be $(\cm, \cb_Y)$-measurable functions, then the following functions are measurable:
    \begin{enumerate}
        \item For any metric $d$ on $Y$, $x \mapsto d(f(x), f(y))$.
        \item If $Y$ is a TVS over $K \in \RC$ and $\lambda \in K$, $\lambda f + g$. In particular, $\bracs{f = g} \in \cm$.
        \item If $Y \in \RC$, $fg$.
    \end{enumerate}
\end{proposition}
\begin{proof}
    By \autoref{proposition:metric-measurable-fibre-product}.
\end{proof}

\begin{proposition}
\label{proposition:metric-measurable-compose}
    Let $(X, \cm)$ be a measurable space, $Y$ be a metrisable topological space, and $f: X \to Y$ be a function, then the following are equivalent:
    \begin{enumerate}
        \item $f$ is $(\cm, \cb_Y)$-measurable.
        \item For each $\phi \in C(X; [0, 1])$, $\phi \circ f$ is $(\cm, \cb_\real)$-measurable.
    \end{enumerate}
\end{proposition}
\begin{proof}
    (2) $\Rightarrow$ (1): For each $U \subset X$ open, the function
    \[
    d_{U^c}: X \to [0, 1] \quad x \mapsto d(x, U^c) \wedge 1
    \]

    is continuous by \autoref{proposition:set-distance-continuous}. By \autoref{proposition:fattening-closure}, $\bracsn{d_{U^c} > 0} = U$. Thus $\bracs{f \in U} = \bracsn{d_{U^c} \circ f > 0}$.
\end{proof}

\begin{proposition}
\label{proposition:metric-measurable-limit}
    Let $(X, \cm)$ be a measurable space, $Y$ be a metrisable topological space, and $\seq{f_n}$ be $(\cm, \cb_Y)$-measurable functions, then:
    \begin{enumerate}
        \item If $Y$ is completely metrisable, then $\bracsn{\limv{n}f_n \text{ exists}} \in \cm$.
        \item If $f = \limv{n}f_n$ exists, then it is $(\cm, \cb_Y)$-measurable.
    \end{enumerate}
\end{proposition}
\begin{proof}
    (1): Let $d$ be a complete metric on $Y$, then for any $x \in X$, $\limv{n}f_n(x)$ exists if and only if $\seq{f_n(x)}$ is Cauchy. In which case,
    \[
    \bracs{\limv{n}f_n \text{ exists}} = \bigcap_{k \in \natp}\bigcup_{N \in \natp}\bigcap_{m \in \natp}\bigcap_{n \in \natp}\bracsn{d(f_m, f_n) < 1/k}
    \]

    is measurable by \autoref{proposition:metric-measurables}.

    (2): For each $\phi \in C(X; [0, 1])$, $\phi \circ f = \limv{n}\phi \circ f_n$ is $(\cm, \cb_\real)$-measurable by \autoref{proposition:limit-measurable}. Thus $f$ is $(\cm, \cb_\real)$-measurable by \autoref{proposition:metric-measurable-compose}.
\end{proof}


\begin{proposition}
\label{proposition:measurable-simple-separable}
    Let $(X, \cm)$ be a measurable space, $Y$ be a separable metric space, and $N: Y \to 2^Y$ such that
    \begin{enumerate}
        \item[(a)] For each $y \in Y$, $y \in \ol{N(y)^o}$.
        \item[(b)] $\bigcap_{y \in Y}N(y) \ne \emptyset$.
        \item[(c)] For any $y_0 \in Y$, $\bracs{y \in Y|y_0 \in N(y)} \in \cb_Y$.
    \end{enumerate}

    Then, for any $f: X \to Y$, the following are equivalent:
    \begin{enumerate}
        \item $f$ is $(\cm, \cb_Y)$-measurable.
        \item There exists a sequence $\seq{f_n}$ of $(\cm, \cb_Y)$-measurable simple functions such that
        \begin{enumerate}
            \item[(i)] For each $x \in X$ and $n \in \natp$, $f_n(x) \in N(f(x))$.
            \item[(ii)] $f_n \to f$ pointwise.
        \end{enumerate}

        \item There exists a sequence $\seq{f_n}$ of $(\cm, \cb_Y)$-measurable simple functions such that $f_n \to f$ pointwise.
    \end{enumerate}
\end{proposition}
\begin{proof}
    (1) $\Rightarrow$ (2): Let $\seq{y_n} \subset Y$ be a dense subset of $Y$. Assume without loss of generality that $y_1 \in \bigcap_{y \in Y}N(y)$. For each $N \in \nat$ and $x \in X$, let
    \[
    C(N, x) = \bracs{1 \le n \le N|y_n \in N(f(x))}
    \]

    By assumption (b), $1 \in C(N, x) \ne \emptyset$. Let
    \[
    k(N, x) = \min\bracs{n \in C(N, x) \bigg | d(f(x), y_n) = \min_{m \in C(N, x)}d(f(x), y_m)}
    \]

    then for any $k \in \natp$, $\bracs{x \in X|k(n, x) \le k}$ is equal to
    \[
     \bigcup_{j = 1}^k\bracs{x \in X \bigg |y_j \in C(n, x), d(f(x), y_j) = \min_{m \in C(N, x)}d(f(x), y_m)}
    \]

    For each $1 \le m \le N$, $y \mapsto d(y, y_m)$ is continuous. Thus $x \mapsto d(f(x), y_m)$ and $x \mapsto \min_{m \in C(N, x)}d(f(x), y_m)$ are $(\cm, \cb_\real)$-measurable by \autoref{proposition:limit-measurable} and assumption (c). By \autoref{proposition:metric-measurables},
    \[
    \bracs{x \in X \bigg | d(f(x), y_j) = \min_{m \in C(N, x)}d(f(x), y_m)} \in \cm
    \]

    for each $1 \le j \le k$. Combining this with assumption (c) shows that $\bracs{x \in X|k(n, x) \le k} \in \cm$.

    Let $f_N(x) = y_{k(N, x)}$, then for each $N \in \natp$, $f_N(x) \subset \bracs{y_n|1 \le n \le N}$, so $f_N(x)$ is finitely valued. Since $x \mapsto k{(N, x)}$ is $(\cm, 2^\nat)$-measurable, $f_N$ is $(\cm, \cb_Y)$-measurable.

    Fix $x \in X$, then
    \[
    f(x) \in \ol{N^o(f(x))} = \ol{\bracs{y_n| n \in \natp, y_n \in N^o(f(x))}}
    \]

    by assumption (a) and \autoref{definition:dense}. Thus for any $\eps > 0$, there exists $N \in \nat$ such that $y_N \in N^o(f(x))$ and $d(f(x), y_N) < \eps$. In which case, $d(f(x), f_n(x)) < \eps$ for all $n \ge N$. Therefore $f_n \to f$ pointwise.

    (3) $\Rightarrow$ (1): By \autoref{proposition:metric-measurable-limit}.
\end{proof}

\begin{proposition}
\label{proposition:measurable-simple-separable-norm}
    Let $(X, \cm)$ be a measurable space, $(E, \norm{\cdot}_E)$ be a separable normed vector space, and $f: X \to E$, then the following are equivalent:
    \begin{enumerate}
        \item $f$ is $(\cm, \cb_E)$-measurable.
        \item There exists simple functions $\seq{f_n}$ such that $\abs{f_n} \le \abs{f}$ for all $n \in \natp$, and $f_n \to f$ pointwise.
    \end{enumerate}
\end{proposition}
\begin{proof}
    Let
    \[
    N: E \to 2^E \quad y \mapsto B_E(0, \norm{y}_E)
    \]

    then
    \begin{enumerate}
        \item[(a)] $y \in \ol{B_E(0, \norm{y}_E)}$.
        \item[(b)] $0 \in \bigcap_{y \in E}N(y)$.
        \item[(c)] For any fixed $y_0 \in E$,
        \[
        \bracs{y \in E|y_0 \in N(y)} = \bracs{y \in E|\norm{y_0}_E \le \norm{y}_E} \in \cb_E
        \]

    \end{enumerate}

    By \autoref{proposition:measurable-simple-separable}, (1) and (2) are equivalent.
\end{proof}
