A Question on Borel Measurable Functions Define $A, B:[a,b] \to \mathbb R$ by
$$
A(x) = \lim_{\epsilon \to 0} \sup_{y\in [a,b]\\|x-y|<\epsilon} f(y), \quad B(x) = \lim_{\epsilon \to 0} \inf_{y\in [a,b]\\|x-y|<\epsilon} f(y),
$$
where $f:[a,b]\to\mathbb R$ is bounded function on $[a,b]$.
I want to show that 
(i) $A, B$ are borel measurable functions.
(ii) If $f$ is continuous at $x_0$, then $A(x_0) = f(x_0) = B(x_0)$.
(iii) If $A(x_0) = B(x_0)$ then $f$ is continuous at $x_0$.
Actually I have no idea for (i) because I could not express $A,B$ as some limit of measurable functions. For (ii) I obtained that for any $x \in [a,b]$, $B(x) \le f(x) \le A(x)$. Please help me.
 A: I'll do (i) for $A$ and leave to you the specular argument for $B$.
The proof I propose can be replicated in any metric space, therefore I'll mix the general notation with the one of the real line.
Call $\mathcal B(x,r)$ the open ball centered in $x$ with radius $r$. As already pointed out, if we define, for $\varepsilon>0$ and $x\in[a,b]$, $$g_\varepsilon(x)=\sup\{f(y)\,:\,y\in \mathcal B(x,\varepsilon)\cap[a,b]\}$$ (these real numbers are well defined because $f$ is bounded) then the family of functions $(g_\varepsilon\,:\,\varepsilon>0)$ is an increasing family, id est, $$\varepsilon<\delta\implies\forall x,\ g_\varepsilon(x)\le g_\delta(x)$$ because of the fact that $\mathcal B(x,\delta)\cap[a,b]\supseteq\mathcal B(x,\varepsilon)\cap[a,b]$.
So, in order to prove that the decreasing limit $A(\bullet)=\lim_{\varepsilon\to 0^+} g_\varepsilon(\bullet)$ is a Borel function, you only need to prove that each $g_\varepsilon$ is Borel. But each of these functions is actually lower semi-continuous on the interval $[a,b]$, id est, for all $\alpha$ the set $g^{-1}_\varepsilon(\alpha,\infty):=\{x\in [a,b]\,:\, g_\varepsilon(x)>\alpha\}$ is an open subset of $[a,b]$.
In fact let $x\in g_\varepsilon^{-1}(\alpha,\infty)$. $$\sup\{f(y)\,:\,y\in \mathcal B(x,\varepsilon)\cap[a,b]\}>\alpha\iff \exists y'\in\mathcal B(x,\varepsilon)\cap[a,b],\ f(y')>\alpha$$
Since $\lvert x-y'\rvert<\varepsilon$, I claim that $\mathcal B(x,\varepsilon-\lvert x-y'\rvert)\cap[a,b]\subseteq g_\varepsilon^{-1}(\alpha,\infty)$. In fact, let $z\in\mathcal B(x,\varepsilon-\lvert x-y'\rvert)\cap[a,b]$. Then, $y'\in\mathcal B(z,\varepsilon)$, since $$\lvert z-y'\rvert\le\lvert z-x\rvert+\lvert x-y'\rvert<\varepsilon-\lvert x-y'\rvert+\lvert x-y'\rvert$$ and by definition $f(y')>\alpha$. So, indeed $g_\varepsilon(z)>\alpha$, which proves that $g^{-1}_\varepsilon(\alpha,\infty)$ is a neighbourhood in $[a,b]$ of all its points.
For $B$, there is $\inf$ instead of $\sup$, the family $(\widehat g_\varepsilon\,:\, \varepsilon>0)$ is decreasing (hence the limit as $\varepsilon\to 0^+$ is increasing) and there is to prove that the new $\widehat g_\varepsilon$ are upper semi-continuous, id est that $\widehat g_\varepsilon^{-1}(-\infty,\alpha)$ is open.
(ii) is rather obvious, and I have not much to add to the other answer.
Now, to (iii). As you've already proven, $B(x)\le f(x)\le A(x)$ always holds. Suppose $A(x_0)=f(x_0)=B(x_0)$ and assume as a contradiction that $f$ is not continuous at $x_0$. Since $[a,b]$ is a metric space, there must be a sequence $y_n\to x_0$ and a fixed $\delta>0$ such that for all $n\in\Bbb N$, $f(y_n)\in (-\infty,f(x_0)-\varepsilon)\cup(f(x_0)+\varepsilon,+\infty)$. Up to extracting a subsequence, we can assume that $f(y_n)$ lies in either of the two components. If, say, $f(y_n)\in(f(x_0)+\varepsilon,+\infty)$ for all $n$, this means that $\sup\{f(y)\,:\, \lvert x_0-y\rvert<\varepsilon\wedge y\in[a,b]\}\ge f(x_0)+\varepsilon$ for all $\varepsilon>0$, since we have the points $y_n\to x_0$. Hence, $A(x_0)\ge f(x_0)+\varepsilon$, which is absurd. Again, a specular argument works with $B$ in case $f(y_n)\in(-\infty,f(x_0)-\varepsilon)$.
A: $(i.)$ I can offer a proof if we assume that the functions $f_n$ defined by $f_n(x)=\sup_{y\in [a,b]\\|x-y|<1/n}f(y)$ are measurable because in this case, since $A(x)=\lim_{n\to \infty}f_n(x), A$ is also measurable. Similarly, $B$ is measurable. 
$(ii).$ Let $\epsilon >0.$ Then, there is a $\delta>0$ such that $|x_0-y|<\delta\Rightarrow |f(x_0)-f(y)|<\epsilon.$ Therefore, as soon as $n\ge N=1/\delta$ we have $|f_n(x)-f(x_0)|\le \epsilon, $ which shows that $A(x_0)=\lim_{n\to \infty}f_n(x)=f(x_0).$  It is no harder to show that $B(x_0)=f(x_0).$
$(iii).$  Define $g_n$ by $g_n(x)=\inf_{y\in [a,b]\\|x-y|<1/n}f(y), $ so that $B(x)=\lim_{n\to \infty}g_n(x).$ Then, $g_n(x_0)<f(x_0)<f_n(x_0)$ and the result follows from the definition of $f_n$ and $g_n$ and letting $n\to \infty.$
A: The function $A$ is upper semi-continuous, which means that $L_t:=\{z:A(z)<t\}$ is open for each real $t$. One of the familiar criteria for measurability now implies that $A$ is Borel measurable. 
As for the semi-continuity assertion, define $A_n(x):=\sup_{\{y:|y-x|<1/n\}}f(y)$, so that $A_n(x)$ decreases to $A(x)$ as $n\to\infty$. Fix $t\in\Bbb R$ and  $x\in L_t$. Choose (and fix) $n$ so large that $A_n(x)<t$.  If $|y-x|<1/(3n)$ then $(y-1/(3n),y+1/(3n))\subset(x-1/n,x+1/n)$ and so $A_{3n}(y)\le A_n(x)<t$. Consequently $A(y)\le A_{3n}(y)<t$. Thus, the open interval $(x-1/(3n),x+1/(3n))$ is contained in $L_t$. This shows that $L_t$ is a neighborhood of each of its points, hence $L_t$ is open.
