A characterisation of continuous real functions Let $f: \mathbb R^n \to \mathbb R$ be a measurable function.
We say $f$ is precise if for every $x \in \mathbb R^n$ and every compact subset $K$ of $\mathbb R^n$ such that for $|K \cap B_\delta (x)|>0$ for every $\delta>0$, we have :

*

*$\lim_{\delta \to 0^+} \text{essinf}_{K \cap B_\delta (x)} f = \lim_{\delta \to 0^+} \inf_{K \cap B_\delta (x)} f$

*$\lim_{\delta \to 0^+} \text{esssup}_{K \cap B_\delta (x)} f = \lim_{\delta \to 0^+} \sup_{K \cap B_\delta (x)} f$.

Question: Is it true that $f$ is precise if and only if $f$ is continuous?
 A: Edit: the proof can be made a little simpler.
Yes, this condition is equivalent to $f$ being continuous. The reverse direction is easy because if $f$ is continuous at $x$ then all of the limits in question equal $f(x)$. For the forward direction, suppose $f$ is not continuous at some point $x$. Wlog $f(x) > \lim_{\delta \to 0}{\rm inf}_{B_\delta(x)} f$. Choose $\epsilon$ so that $f(x) > f(x) - \epsilon > \lim_{\delta \to 0} {\rm inf}_{B_\delta(x)} f$ and set $A = \{y: f(y) \leq f(x) - \epsilon\}$. If for some $\delta > 0$ the set $A \cap B_\delta(x)$ has measure zero, then ${\rm essinf}_{B_{\delta'}} f \geq f(x) - \epsilon$ for all $\delta' \leq \delta$, which means that the limit of the essential infs is $\geq f(x) - \epsilon$, which is strictly greater than the limit of the infs, showing that $f$ is not precise. Otherwise $A \cap B_\delta(x)$ has positive measure for all $\delta$. For each $n \in \mathbb{N}$ let $K_n$ be a positive measure compact subset of $A \cap B_{1/n}(x)$; then $K = \{x\} \cup \bigcup K_n$ is a compact set for which $\lim_{\delta \to 0}{\rm esssup}_{K \cap B_\delta(x)} f \leq f(x) - \epsilon$ (since the sup on $K \cap B_\delta(x) \setminus\{x\}$ is at most $f(x) - \epsilon$), whereas $\lim_{\delta \to 0}\sup_{K \cap B_\delta(x)} f \geq f(x)$. So the condition is violated again.
