$C_c(X)$ dense in $L^p$

In class we proved that $C_c(X)$ is dense in $L^p$ where $X$ is a locally compact, $\sigma$-compact Hausdorff space either equipped with a Radon measure or equipped with a locally finite measure $\mu$ on the Borel sigma algebra.

The proofs, especially of the second variant are fairly long and I find it very hard to remember all the conditions (locally finite, $\sigma$-compact etc.). The first variant uses Lusin's theorem (among others). So I thought I might try to reduce this to a more specific case, the Lebesgue measure (which is Radon) and $X$ any subset of $\mathbb R$. (Do I need any assumption on $X$? Perhaps it needs to be measurable.)

Can you tell me if this is correct? Thank you.

Claim: $C_c(X)$ is dense in $L^p$ with the Lebesgue measure and $X \subset \mathbb R$.

Proof: We know that simple functions are dense in $L^p$. So if we can construct a function in $C_c$ that is $\varepsilon$-close (in $\|\cdot\|_p$) to $\chi_M$, the characteristic function of a measurable set $M$ then we're done. We know that $\mu$ is inner and outer regular so for $\varepsilon > 0$ we can find a compact set $K \subset M$ such that $\mu(M - K ) \leq \varepsilon$. Also, we can find an open set $O$ containing $M$. Let $f : K \sqcup O^c \to \mathbb R$ be the function that is $1$ on $K$ and $0$ on $O^c$. Then using Tietze we can continuously extend it to all of $X$. Then its extension $F \in C_c(X)$ and $$\|F - \chi_M \|_p^p = \int_X |F - \chi_M|^p d \mu = 1 \cdot \mu(M -K)^p \leq \varepsilon^p$$

So I don't need Lusin's theorem. Right?

-
You just proved that $F\in C(X)$. Why $F$ is compactly supported? –  Norbert Jul 13 '12 at 21:10
I may be missing something but isn't this more or less what's done in quite some detail in the accepted answer to your earlier question? The objection Norbert raised is worked around as well in that answer and it is explicitly stated that you don't need Lusin there. –  t.b. Jul 13 '12 at 23:59
@t.b. You're missing nothing, of course. I was trying to avoid Lusin and I didn't remember that I'd asked this question before. –  Matt N. Jul 14 '12 at 4:45
For each $x \in K$ choose an open neighborhood $U_x$ of $x$ with compact closure (by local compactness of $X$). Extract a finite subcover $U_1,\ldots,U_n$ of the cover $\{U_x\}_{x \in K}$ of $K$ (by compactness of $K$). Let $U = U_1 \cup \cdots \cup U_n$, note that $\overline{U} = \overline{U}_1 \cup \cdots \cup \overline{U}_n$ is compact. Set $g = 1$ on $K$ and $g = 0$ on $U^c$ and apply Urysohn to get a continuous function $g\colon X \to [0,1]$ with $g|_K \equiv 1$ and $g|_{U^c} \equiv 0$. In particular $\operatorname{supp}g\subset \overline{U}$, which is compact. –  t.b. Jul 14 '12 at 6:55
Note that a locally compact space need not be normal, but you can alwas separate disjoint closed sets $A$ and $B$, where $A$ is compact, with disjoint open sets $U \supset A$ and $V \supset B$ such that $\overline{U}$ is compact. Then the usual onion shell proof of Urysohn's lemma (which is usually given for normal spaces) yields a continuous function with compact support. –  t.b. Jul 14 '12 at 6:59