Separability requirement for Measurable distance? I was looking up Egorov's Theorem on Wikipedia. http://en.wikipedia.org/wiki/Egorov%27s_theorem
One of the conditions is that the functions attain values in a separable metric space M, and in the "Discussion of assumptions" section following the theorem, the following is stated:
"The separability of the metric space is needed to make sure that for M-valued, measurable functions f and g, the distance d(f(x), g(x)) is again a measurable real-valued function of x."
Can someone explain how to prove the boldfaced statement? 
[EDIT]To be precise, I want to know how to prove "If the metric space M is separable, and the functions f and g are measurable functions attaining values in M, then the distance function d(f(x),g(x)) is measurable."
Thanks!
 A: A more elegant and intuitive way (that I've come up with upon finishing the direct proof, so I'll leave it anyway...) to show it is as follows: if $M$ is a separable metric space, it is second-countable.
From that it follows that open sets are Borel in $M^2$ (with respect to the square of Borel algebra of $M$; this is because we don't need uncountable unions to form open sets).
In particular, continuous functions from $M^2$ to $\bf R$, such as $d$, are Borel with respect to product algebra. On the other hand, $x\mapsto (f(x),g(x))$ is obviously measurable with respect to the product Borel algebra, so the composition of this and $d$ is measurable.
A: (Note: this is a direct, but rather haphazard proof, I've posted another answer with a more intuitive one, but I've already written down this one, so I'll leave it here.)
Denote $d(f(x),g(x))$ by $h(x)$, and enumerate the countable dense subset of $M$ with $s_n$. Note that $h(x)=r$ if and only if you have
$$
(\forall n\forall m)\;d(f(x),s_n)<1/m\implies r-1/m<d(g(x),s_n)<r+1/m
$$
To show measurability of $h$, it's enough to show that preimages of closed intervals are measurable, or to show that their complements are. But by looking at the previous formula, you can see that $h(x)\notin [a,b]$ if and only if
$$
(\exists n\exists m)\;d(f(x),s_n)<1/m\land (a-1/m\geq d(g(x),s_n)\lor d(g(x),s_n)\geq b+1/m)
$$
So $X\setminus h^{-1}[[a,b]]$ is a countable union of measurable sets, and we're done.
A: Suppose that $\{y_n:n\in \mathbb{N}\}$ is a countable dense subset of the separable metric space $(M,d).$ For each $n\in \mathbb{N},$ let $F_n,G_n\colon X\to \left[0,\infty\right)$ be the measurable functions
\begin{align*}
F_n(x) &= d(f(x),y_n)\\
G_n(x) &= d(g(x),y_n).
\end{align*}
Indeed these functions are measurable because they are the compositions of the continuous function $d(\cdot,y_n)$ with the measurable functions $f$ and $g$, respectively. By the triangle inequality, $H\leq F_n+G_n$ for every $n\in \mathbb{N},$ making $H(x)$ a lower bound on the set $\{F_n(x)+G_n(x):n\in \mathbb{N}\}$ for every $x\in X.$ To see that $H(x)$ is the greatest lower bound on this set, consider $\varepsilon>0,$ and let $N\in \mathbb{N}$ be such that $d(g(x),y_N)<\frac{\varepsilon}{2},$ and hence $2d(g(x),y_N)<\varepsilon.$ Then
\begin{align*}
F_N(x)+G_N(x) &= d(f(x),y_N)+d(g(x),y_N)\\
&\leq d(f(x),g(x))+2d(g(x),y_N)\\
&<H(x)+\varepsilon,
\end{align*}
so that $H(x)+\varepsilon$ fails to be a lower bound on $\{F_n(x)+G_n(x):n\in \mathbb{N}\}.$ Since $\varepsilon>0$ was arbitrary,
$$
H(x)=\inf_{n\in \mathbb{N}}\left(F_n(x)+G_n(x)\right).
$$
This is true of all $x\in X,$ hence $H$ is the measurable function $\inf_{n\in \mathbb{N}}\left(F_n+G_n\right),$ where we recall that the pointwise infimum of a countable family of measurable functions is measurable.
