On the definition of the Sobolev space $W^{1,p}(I)$ I am reading Brezis, and I'm struggling to see why the remark following this definition is true:



Let us say we assumed that $\varphi \in C^{\infty}_c(I)$ in the definition. To arrive at an equivalent definition, we have to show that any $\varphi \in C^1_c(I)$ satisfies
$$ \int_I u\varphi' = -\int_I g \varphi.$$
As the author says, by using convolution by mollifier sequences we know that we can approximate $\varphi$ with a sequence of $C_c^{\infty}$ functions $\varphi_n,$ but the convergence is only uniform on compact subsets. Hence, we can't simply take a uniform limit of the equality
$$ \int_I u\varphi_n' = -\int_I g \varphi_n$$
as I had hoped (even then, now that I think about it, the derivative might also pose a problem). Can anyone explain why the definitions are equivalent? Thanks!

There is a compact set $K\subset I$ and an open set $U\subset K$ such that $\mathrm{supp}\,\varphi\subset U$ and $\mathrm{supp}\,\varphi_n\subset U$ for all $n$. We have $\varphi_n$ and $\varphi_n'$ converging uniformly in $K$ to $\varphi$ and $\varphi'$, respectively. This should settle the issue.
