Solution (source code)

= Solution
{c}

Boundedness of $f$ makes $\varphi$ finite and nonnegative. Suppose $\varphi(x_0)<a$. By its infimum definition, some $n$ satisfies $\varphi_n(x_0)<a$. If $|x-x_0|<1/(2n)$, then
$$
(x-1/(2n),x+1/(2n))\subset(x_0-1/n,x_0+1/n).
$$
The supremum over the smaller interval cannot exceed that over the larger one. Hence
$$
\varphi(x)\leq\varphi_{2n}(x)\leq\varphi_n(x_0)<a.
$$
Thus $\{\varphi<a\}$ is open for every $a$, proving \b[$\varphi$ is upper semicontinuous]. Measurability of the original $f$ was never needed: these are purely pointwise oscillation bounds.