Approximating compactly supported $L^2$ functions with Schwartz functions "from within"? Crossposted from MathOverflow.
It is well known that the class of Schwartz functions $\mathcal{S}$ in dense in all $L^p$ spaces therefore for each $f \in L^2$ there exists a sequence of Schwartz functions $(f_k)$ such that $\lVert f - f_k \rVert_{L^2} \to 0$ as $k \to \infty$.
If we suppose further that $f$ has compact support can we find a sequence of Schwartz functions $(f_k)$ such that $\lVert f - f_k \rVert_{L^2} \to 0$ as $k \to \infty$ (as above) and additionally $\operatorname{supp}(f_k) \subseteq \operatorname{supp}(f)$ for all $k$?
If so, what argument can I appeal to?
 A: If $E$ is a compact set with positive measure and empty interior, and if $f$ is the characteristic function of $E$, then $f$ is nonzero in $L^2$ and there is no nonzero continuous function whose support is contained in the support of $f$.
To construct such a set $E$, find an enumeration of $[0,1]\cap\mathbb Q$, say $\{q_n\}_{n=1}^\infty$, and for each $n$ choose an open interval $I_n$ around $q_n$ with length $\varepsilon /2^n$.
Then $U:= \bigcup I _n$ is an open set whose measure is at most $\varepsilon$, and
$$
E:= [0,1]\setminus U
$$
is a compact set with empty interior and measure at least $1-\varepsilon$.
A: Not if $$f = \lim_{N\to \infty} f_N, \qquad f_N=1_{[0,1]} \prod_{n=1}^N \prod_{k=0}^{2^n-1} (1-1_{\displaystyle [\frac{k}{2^n}-\frac1{2^{2n+2}},\frac{k}{2^n}+\frac1{2^{2n+2}}]})$$
$\lim_{N\to \infty} f_N$ converges in $L^p(\Bbb{R})$, the limit is non-zero since $\int_0^1 f_N(x)dx\ge 1-\sum_{n=1}^N 2^{-n-1}$
The support of $f$ doesn't contain any $k/2^n$ so it doesn't contain any open set.
