Are smooth solutions to a PDE dense in the space of $L^2$ solutions to the PDE? Let's say I have a linear differential operator $P$ with smooth coefficients between bundles $E$ and $F$ over a smooth compact manifold $X$ with smooth boundary. Let's consider $P$ as an operator between the Sobolev spaces $P\colon L^2(X;E)\to L^2_{-m}(X;F)$, giving us a subspace $\ker P\subseteq L^2(X;E)$. Is $\ker P\cap C^\infty(X;E)$ dense in $\ker P$?
For example, we can consider $d\colon L^2(B^n;\bigwedge^*T^*B^n)\to L^2_{-1}(B^n;\bigwedge^*T^*B^n)$, in which case the question asks whether smooth closed forms on a ball are $L^2$-dense in $L^2$ closed forms on the ball.
I suspect that the answer to the question is yes, at least with appropriate assumptions, but if you know of an analysis textbook that handles something like this situation, I'd appreciate a reference.
 A: I don't think there's any reason this will hold for an arbitrary differential operator with smooth coefficients. If the operator has additional structure (such as ellipticity) then one can say something meaningful.
As pointed out in the comments above, the result follows easily from elliptic regularity if either: 1) $X$ is closed (has no boundary); or 2) by $\ker P$ you really mean "sections that satisfy $Pu = 0$ plus an appropriate boundary condition."
A more interesting question is when $X$ has a boundary (as in the original question) and no boundary conditions are imposed. Then $\ker P$ is infinite-dimensional and contains sections that are not smooth all the way up to the boundary. However, one can still give an affirmative answer to this problem if $P$ is elliptic and the Dirichlet realizations of $P$ and $P^*$ both have trivial kernel.
The key ingredients are: 1) elliptic regularity; 2) unique solvability of the Dirichlet problem; and 3) continuous dependence of the solution on the boundary data. As an illustration, I'll describe the case of the Laplacian on a smooth, bounded domain $\Omega \subset \mathbb{R}^n$.
Suppose $u \in H^1(\Omega)$ solves $\Delta u = 0$ in a weak (distributional) sense. Then $f := \left.u\right|_{\partial\Omega}$ is contained in $H^{1/2}(\partial\Omega)$, so there exists a sequence $\{f_j\}$ in $C^\infty(\partial\Omega)$ such that $\|f - f_j\|_{H^{1/2}(\partial\Omega)} \to 0$. For each $j$ the Dirichlet problem $$\Delta u_j = 0, \quad \left.u_j\right|_{\partial\Omega} = f_j$$ has a unique solution. Since $f_j$ is smooth, elliptic regularity implies $u_j \in C^{\infty}(\overline{\Omega})$. Moreover, one has the estimate $$\|u_j\|_{H^1(\Omega)} \leq C \|f_j\|_{H^{1/2}(\partial\Omega)}$$ where $C$ does not depend on $j$, so $u_j \to u$ in $H^1(\Omega)$. Therefore, the set of smooth (up to the boundary) harmonic functions is $H^1$-dense in the set of weakly harmonic functions.
