Equivalent definitions of oscillation Yesterday I had to deal for the first time with the concept of oscillation: I found this wide general definition:

Let $X$ a topological space, $(Y,d)$ a metric space and $f:X\to Y$ a map. The value $$\omega_f(x_0):=\inf\Big\{\sup_{x,y\in U}d(f(x),f(y))\,|\,U\subseteq X\,\mathrm{neighbourhood\,of}\,x_0\Big\}\in[0,+\infty]$$ is called oscillation of $f$ in $x_0\in X$.

In particular, if we assume $f:(X,d)\to\mathbb R$ with its natural metric, its pretty obvious that $$\omega_f(x_0)=\inf_{\varepsilon>0}\,\sup_{x,y\in B_\varepsilon(x_0)} |f(x)-f(y)|=\inf_{\varepsilon>0}\left[\sup_{x\in B_\varepsilon(x_0)} f(x)-\inf_{x\in B_\varepsilon(x_0)} f(x)\right]\qquad(\ast)$$ where $B_\varepsilon(x_0)\subseteq X$ is the open ball centered $x_0$ with radius $\varepsilon>0$ in the metric space $(X,d)$. Now I ask if there's a relationship between oscillation, limsup and liminf of $f$ in $x_0$: I imagine that the following holds $$\omega_f(x_0)=\limsup_{x\to x_0} f(x)-\liminf_{x\to x_0} f(x).$$ On this way, I think to have proved one inequality: if we say $B_\varepsilon:=B_\varepsilon(x_0)$ and $B^*_\varepsilon:=B_\varepsilon\setminus\{x_0\}$, then we have $$\limsup_{x\to x_0} f(x)-\liminf_{x\to x_0} f(x)=\inf_{\varepsilon>0}\sup_{x\in B^*_\varepsilon} f(x)-\sup_{\varepsilon>0}\inf_{x\in B^*_\varepsilon} f(x)\leq\inf_{\varepsilon>0}\sup_{x\in B_\varepsilon} f(x)-\sup_{\varepsilon>0}\inf_{x\in B_\varepsilon} f(x)=\\=\inf_{\varepsilon>0}\sup_{x\in B_\varepsilon} f(x)+\inf_{\varepsilon>0}\sup_{x\in B_\varepsilon} (-f(x))\leq\inf_{\varepsilon>0}\left[\sup_{x\in B_\varepsilon} f(x)+\sup_{x\in B_\varepsilon} (-f(x))\right]=\omega_f(x_0)$$ where the last equality holds for $(\ast)$. Suppose these lines up here are correct, I can't help myself proving the opposite inequality and so I ask for your ideas -- any hint is appreciated :-)
 A: The other inequality does not hold, to see this consider the function
$$
f: \mathbb R \to \mathbb R \\
f(x)=\begin{cases}1 & x=0\\0 & \text{otherwise}\end{cases}
$$
then on one hand we have $\limsup_{x\to 0} f(x)=\liminf_{x\to 0}=0$ and hence their difference is $0$, and on the other hand, $\omega_f(0)=1$.
In fact we can make the oscilation as big as we want without changing $\limsup_{x\to x_0} f(x) - \liminf_{x\to x_0} f(x)$, and this is exactly because the former depends on $f(x_0)$ while the latter doesn't.
A: I am quite sure I was wrong about the equality, too. I just found some papers and past answer on MSE where they say that $$\omega_f(x_0)=\max\left\{f(x_0),\limsup_{x\to x_0} f(x)\right\}-\min\left\{f(x_0),\liminf_{x\to x_0} f(x)\right\}$$ when $x_0$ is a limit point for $X$. I appreciate any correction to the proof of this fact (still unfound on internet) that I just tried to put down -- the notations are the same of the initial post .

Consider the two real functions $$\varepsilon>0\mapsto \sup_{x\in B_\varepsilon} f(x)=\max\left\{f(x_0),\sup_{x\in B^*_\varepsilon} f(x)\right\}$$ $$\varepsilon>0\mapsto \inf_{x\in B_\varepsilon} f(x)=\min\left\{f(x_0),\inf_{x\in B^*_\varepsilon} f(x)\right\}$$ and observe that the first is increasing while the second decreasing. Therefore, their difference $$\varepsilon>0\mapsto \sup_{x\in B_\varepsilon} f(x)-\inf_{x\in B_\varepsilon} f(x)$$ is increasing and so exists the limit at $\varepsilon\to 0^+$ as $$\lim_{\varepsilon\to 0^+}\left[\sup_{x\in B_\varepsilon} f(x)-\inf_{x\in B_\varepsilon} f(x)\right]=\inf_{\varepsilon >0}\left[\sup_{x\in B_\varepsilon} f(x)-\inf_{x\in B_\varepsilon} f(x)\right]=\omega_f(x_0).$$ But we also have that $$\lim_{\varepsilon\to 0^+}\left[\sup_{x\in B_\varepsilon} f(x)-\inf_{x\in B_\varepsilon} f(x)\right]=\lim_{\varepsilon\to 0^+}\sup_{x\in B_\varepsilon} f(x)-\lim_{\varepsilon\to 0^+}\inf_{x\in B_\varepsilon} f(x)$$ since both latter limits exists for monotony -- eventually, we conclude that $$\omega_f(x_0)=\inf_{\varepsilon>0}\sup_{x\in B_\varepsilon} f(x)-\sup_{\varepsilon>0}\inf_{x\in B_\varepsilon} f(x)=\\=\max\left\{f(x_0),\inf_{\varepsilon>0}\sup_{x\in B^*_\varepsilon} f(x)\right\}-\min\left\{f(x_0),\sup_{\varepsilon>0}\inf_{x\in B^*_\varepsilon} f(x)\right\}$$ hence the equality above.

