Show simple functions are dense

Let K be a compact space and let B be the space of bounded borel functions on K equipped with the supremum norm. Show that simple functions (i.e. functions attaining only a finite number of values) are dense in B.

I have thought about this but haven't come up with anything useful so far.

Thanks

Re: Show simple functions are dense

Here is a start: Every compact space is separable so K has a countable dense subset {q_n}.

Re: Show simple functions are dense

We can assume without lost of generality that 0<f<1.

Given e>0 choose n large enough so that 1/n < e.

Subdivide (0,1) into n open subintervals E_j= ((j-1)/n,j/n) for j=1,2,...,n and c_j be the midpoint of every E_j.

Let A_j be the pullpack of E_j, that is, A_j = f^(-1) E_j.

Note that that A_j are mutually disjoint that cover K.

Define g:K-->R by setting g(x) = c_j for x in some A_j. This is a simple well-defined function with at most n values.

For any x in K choose A_j so that x in A_j, then |f(x) - g(x)|<1/n.

Thus, sup|f(x)-g(x)|<1/n<e.

It seems that K being compact is just there for confusion and does not help the solution.