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?