I have a question about Sobolev space.

**Let $\Omega$ be an open subset of $\mathbb{R}^{d}$**,

we consider the Sobolev space

$H^{1}(\Omega):=\left\{ u \in L^{2}(\Omega) : D_{j}u \in L^{2}(\Omega), j=1,\ldots,n \right\}$

with norm

$\|u\|^{2}_{H^{1}(\Omega)}:=\|u\|^{2}_{L^{2}(\Omega)}+\sum_{j=1}^{n}\|D_{j}u\|_{L^{2}(\Omega)}^{2}$,

where $D_{j}u=\partial u/ \partial x_{j}$ is the distributional deriavtive. Moreover, we let

$X:=\left\{ u|{}_{\Omega} \in H^{1}(\Omega): u \in C_{c}(\bar{\Omega})\right\}, $ $Y:=\left\{ u|{}_{\Omega} \in H^{1}(\Omega): u \in C(\bar{\Omega})\right\},$

where $C_{c}(\bar{\Omega})$ denotes the space of all continuous real valued functions on $\bar{\Omega}$ with compact support and $C(\bar{\Omega})$ denotes the space of all continuous real valued functions on $\bar{\Omega}$.

**My question**

For any $\epsilon>0$, $f \in Y$, there exists $\varphi \in X$ s.t. $\|f-\varphi\|_{H^{1}(\Omega)}<\epsilon$ ?

**My attempt 1**

By Tietze extension theorem, we can find $F \in C(\mathbb{R}^{d})$ such that
$f=F$ on $\bar{\Omega}$. Let $J_{\delta}F=\int_{\mathbb{R}^{d}}j_{\delta}(x-y)F(y)\,dy$, where $j_{\delta}$ is mollifier. Then $F_{\delta} \in C_{c}^{\infty}(\mathbb{R}^{d})$ and $J_{\delta}F \to f$ in $L^{2}(\Omega)$ as $\delta \to 0$. Futhermore, since $f \in H^{1}(\Omega)$,
\begin{align*}
\frac{\partial}{\partial x_{i}}J_{\delta}F-\frac{\partial f}{\partial x_{i}}&=J_{\delta}\frac{\partial F}{\partial x_{i}}-\frac{\partial F}{\partial x_{i}}\quad \text{on } \Omega \\
& \to 0 \quad \text{in } L^{2}(\Omega).
\end{align*}
Therefore $\|J_{\delta}F -f\|_{H^{1}(\Omega)} \to 0$ as $\delta \to 0$. **But I don't know $J_{\delta}F \left| \right. _{\Omega} \in C_{c}(\bar{\Omega})$. Can we show $J_{\delta}F \left| \right. _{\Omega} \in C_{c}(\bar{\Omega})$ ?**

**My attempt 2**

If there exist open subset $O$ and compact subset $K$ of $\mathbb{R}^{d}$ s.t. $O \subset K \subset \Omega$ and $\|f\|_{H^{1}(\Omega \setminus K)}<\epsilon$, we take $\psi \in C_{c}^{\infty}(\mathbb{R}^{d})$ s.t. $\psi=1$ on $O$ and $\psi=0$ on $\mathbb{R}^{d} \setminus K$.

Then \begin{align*} \|f \psi -f\|_{H^{1}(\Omega)} &\leq \|f \psi -f\|_{H^{1}(O)}+\|f \psi -f\|_{H^{1}(K \setminus O)}+\|f \psi -f\|_{H^{1}(\Omega \setminus K)} \\ &=\|f -f\|_{H^{1}(O)}+\|f \psi -f\|_{H^{1}(K \setminus O)}+\|0 -f\|_{H^{1}(\Omega \setminus K)} \\ &\leq 0+\|f \psi -f\|_{H^{1}(K \setminus O)}+\epsilon. \end{align*}

**But I don't know how to deal with $\|f \psi -f\|_{H^{1}(K \setminus O)}$ and existence of such $O,K$.**

If you know, please tell me. Thank you in advance.