# Oscillation of a function and continuity

I would be very grateful if somebody could verify my proof.

Assume that $f$ is continuous at $p$. We can always choose $\delta_1>0, \delta_2>0$ such that $d'(f(x),f(p))\le\frac{1}{2n}$ whenever $d(x,p)\le\delta_1$ and $d'(f(y),f(p))\le\frac{1}{2n}$ whenever $d(y,p)\le\delta_2$. Set $\delta=\min\{\delta_1,\delta_2\}$. Then we have $d'(f(x),f(y))\le d'(f(x),f(p))+d'(f(p),f(y))\le\frac{1}{2n}+\frac{1}{2n}=\frac{1}{n}$. Thus oscillation of $f$ at $p$ is equal to $0$.

Now assume that oscillation is equal to $0$. From definition of g.l.b. for any $\epsilon>0$ there exists some open ball $B(p,\delta)$ such that for any $x,y$ in this ball we have $d'(f(x),f(y))\le \epsilon$. Choose $0<\delta'<\delta$ and fix $y=p$ and we have that for any $\epsilon>0$ there is $\delta'$ such that for any $x\in E$ it is true that $d'(f(x),f(p))\le \epsilon$ whenever $d(x,p)\le\delta'$.

The last thing to show is that for any $\epsilon>0$ the set $\{x\in E : \operatorname{osc}(f,x)\ge \epsilon \}$ is closed. It's enough to show that $S=\{x\in E : \operatorname{osc}(f,x)< \epsilon \}$ is open.

I'm not sure if the proof is correct and also I cannot figure out how to finish the last piece. Any hint please?

Your proof seems correct to me. There are, however, some places where you could make the proof simpler. For example, in the first part you can just take $\delta_1=\delta_2=\delta$ as your two deltas are actually the same number. In the second part you don't need to introduce $\delta'$ as your statement about $\delta$ already achieves the result you want.
As for the last part, you've made a sensible start. Now it's just a case of writing out the details. Suppose $x$ is such that $\operatorname{osc}(f,x)=k< \epsilon$. If $a$ is between $k$ and $\epsilon$ then there is a $\delta$ such that for all $z_1,z_2\in B(x,\delta)$ we have $d'(f(z_1),f(z_2))<a$. Given any $x'\in B(x,\delta)$ we can find $\delta'$ such that $B(x',\delta')\subset B(x,\delta)$. Using this we can show that $\operatorname{osc}(f,x')< \epsilon$ so that $S$ is open.