Approximate an $L^2$ function from "inside" Consider a bounded domain $\Omega \subset \mathbb R^d$ and a function $f \in L^2(\Omega)$. Now $f$ can be approximated through a sequence of functions $f_n \in H^1(\Omega)$ (or even $C^\infty(\Omega)$).
My question is: Can I additionally demand $|f_n| \le |f|$ almost everywhere?
Some thoughts / Things I've tried:


*

*Mollification is hard to control and I do not see a way to "fix" a mollified version of $f$ such that it satisfies the constraint and remains smooth.

*Maybe one could first approximate $L^2$ through step functions (i.e. linear combinations of characteristic functions of rectangular boxes) and then approximate those. Approximating them through smooth functions while satisfying the constraint should not be a problem. I know that step functions are dense in $L^2$, but I'm not sure if the constraint can be met (If the limit was Riemann integrable then the answer should be positive, but what about the general case?)


Note: The assumption $f \in L^\infty(\Omega)$ can be made.
 A: This is my thought process about how I would do it. First, as you suggest, I would approximate any $f \in L^2$ by a simple function $g(x) = \sum_{i} a_i \chi_{A_i}$. Second, by inner regularity I would approximate each $A_i$ by a compact set $B_i \subseteq A_i$. Thus, your problem reduces to finding a strictly less than smooth approximation to $\chi_B$ for any compact set $B$.
Now if $B$ has a nonempty interior, then there are portions of it that look like an interval $[a,b]$. We can easily approximate this with a bump function. So let's consider the nowhere dense part of $B$. If it has no positive measure then we are done. But it might. For instance, think of a fat cantor set for instance.
But let's really think about this more. If $\phi(x) \leq \chi_B(x)$ where $B$ is a fat Cantor set with positive measure supported in $[0,1]$, then consider $y \in B$ and $\phi(y) = z > 0$ ($\phi$ must be nonzero somewhere). But for any $y \in B$ there exists a sequence $a_n \to y$ with $a_n \notin B$ because the complement of $B$ is dense. Necessarily, then $\phi(a_n) \leq \chi_B(a_n) = 0$. From this we conclude $\phi(y) = \lim_n \phi(a_n) \leq 0 < z = \phi(y)$, a contradiction.
So the answer the no, you cannot in general find such an approximation. Just take the indicator function of a fat cantor set.
