I'm trying to prove that the space $AC^2([0,1])$ of absolutely continuous, complex-valued functions defined on $[0,1]$, with the property that their derivatives are in $L^2([0,1])$ is dense in $L^2([0,1])$.
My idea for the proof is to show that $\mathcal{S}([0,1]) \subset AC^2[(0,1)]$, where $\mathcal{S}([0,1])$ is the Schwartz space and use the fact that it's dense in $L^2$.
But I only know that $\mathcal{S}(\mathbb{R}^n)$ is dense in $L^2(\mathbb{R}^n)$. So my question is: is this set still dense in $L^2$ after changing the domain to a compact set? Moreover, is this the correct reasoning to solve this problem?
Thank you