If $X$ is a Borel set and $f$ has countably many discontinuities, prove that $f:X\rightarrow \mathbf{R}$ is Borel measurable.
In the question
A function with countable discontinuities is Borel measurable.
the user Luiz Cordeiro argues as follows:
We want to show that $f^{-1}((a,\infty))$ is a Borel set (a function $f$ satisfying this is the definition of a Borel measurable function). Let $a\in \mathbf{R}$ be arbitrary and consider the set $A = f^{-1}((a,\infty))$. We can write this set as a union of its interior and the complement of the interior. That is
$$A = \mathrm{int}(A)\cup\big[A\setminus \mathrm{int}(A)\big].$$
The interior is open and thus Borel measurable. If we can show that its complement in $A$ is Borel measurable, that is $A\setminus \mathrm{int}(A)$, then since any union of Borel measurable sets is Borel measurable it would follow that $A$ is Borel measurable. This follows by the property of the Borel sets being a $\sigma$-algebra.
Let $x\in A\setminus \mathrm{int}(A)$, then $x$ is not an interior point of $A$ meaning that for every $\delta>0$ we can find a point $y_\delta$ such that
$$|x-y_\delta|<\delta\text{ but }y_\delta \notin A.$$
What does this then mean? $A$ is the inverse of $(a,\infty)$ so where does $f(y_\delta)$ belong, certainly not to $(a,\infty)$? Is $f$ continuous at $x$?
Conclude that $A\setminus \mathrm{int}(A)$ is at most countable. How can we then argue that $A\setminus \mathrm{int}(A)$ is measurable?