# Are continuous functions dense in bounded measurable functions of a compact metric space?

Let $$X$$ be a compact metric space equipped with the Borel $$\sigma$$-algebra

Then we have $$C(X)$$, the set of all the real-valued continuous maps on $$X$$, equipped with the sup-norm.

We may also define $$BM(X)$$ as the set of all the real valued bounded measurable functions on $$X$$, and equip this too with the sup norm.

Clearly, we have $$C(X)$$ sitting inside $$BM(X)$$.

Question. Is $$C(X)$$ dense in $$BM(X)$$?

I guess the question boils down to asking that if $$E$$ is a Borel set in $$X$$ then there is a sequence of continuous functions $$(f_n)$$ such that $$\|\chi_E-f_n\|_\infty\to 0$$. But is this true?

No, this is not true even for an interval in $$\mathbb{R}$$.
Recall uniform limit of continuous is continuous, so $$C(X)$$ is closed in $$BM(X)$$ (or its quotient $$L^\infty(X)$$). However, there are bounded discontinuous but measurable functions such as $$f(x)=\begin{cases}1 & x\geq\frac12\\ 0 & x<\frac12 \end{cases}$$ on $$[0,1]$$ that cannot be represented by continuous functions.
It is not dense in $$\|\cdot\|_\infty$$-norm but it is dense with respect to the weak operator topology and the strong operator topology. This follows from von Neumann's double commutant theorem. You can view $$C(X)$$ and $$L^\infty(X)$$ as subalgebras of the bounded operators on the Hilbert space $$L^2(X)$$.