Dense set in Sobolev space ${H^1}\left( {0,1} \right)$ Let 
$$V = \left\{ {v \in {H^2}(0,1):{v_x}\left( 0 \right) - v\left( 0 \right) = {v_x}\left( 1 \right) + v\left( 1 \right) = 0} \right\}.$$
Question: Is $V$ dense in ${H^1}\left( {0,1} \right)$?
I know ${C^\infty }\left( \mathbb{R} \right)$ is dense in ${H^1}\left( {0,1} \right)$. But I can't prove that $V$ is dense in ${H^1}\left( {0,1} \right)$ .
 A: The space $V$ is dense in $H^1(0,1)$. Here are three (more or less) different proofs:
Proof 1 (the pedestrian way):
We set $H^1 := H^1(0,1)$ and $H^2 := H^2(0,1)$.
Fix $h \in H^1$. Since $H^2(0,1)$ is dense in $H^1(0,1)$, there exists a sequence $(f_n)_{n \in \mathbb{N}} \subseteq H^2(0,1)$ that converges to $h$ with respect to the $H^1$-norm.
Now, for each index $n$ we can construct a $H^2$-function $g_{n,0}$ which is zero on $[1/2,1]$ and satisfies 
\begin{align*}
  g_{n,0}(0) = 0, \quad g_{n,0}'(0) = f_n'(0) - f_n(0) \quad \text{and} \quad \|g_{n,0}\|_{H^1} \le 1/n
\end{align*}
(see below for details). Similary we can construct, for each index $n$, a $H^2$-function $g_{n,1}$ which is zero on $[0,1/2]$ and satisfies
\begin{align*}
  g_{n,1}(1) = 0, \quad g_{n,1}'(0) = f_n'(1) + f_n(1) \quad \text{and} \quad \|g_{n,1}\|_{H^1} \le 1/n.
\end{align*}
Now $(f_n - g_{n,0} - g_{n,1})_{n \in \mathbb{N}}$ is a sequence in $V$ that converges to $h$ with respect to the $H^1$-norm.
Note. In the above proof we used the following
Lemma. For each (real or complex) number $\alpha$ and each positive integer $n$ there exists an $H^2$-function $g$ which is $0$ on $[1/2,1]$ and satisfies
\begin{align*}
  g(0) = 0, \quad g'(0) = \alpha \quad \text{and} \quad \|g\|_{H^1} \le 1/n.
\end{align*}
Proof of the lemma. Consider any number $\delta \in (0,1/3)$. Let $u$ be the piecewise linear function on $[0,1]$ which is defined by the following values:
\begin{align*}
\begin{cases}
  u(0) & = 1, \\
  u(\delta) & = 0, \\
  u(2\delta) & = -1/2, \\
  u(3\delta) & = 0, \\
  u(1) & = 0.
\end{cases}
\end{align*}
Then $u$ is an $H^1$-function, so the function $g$ defined by $g(x) = \alpha \int_0^x u(y) \, dy$ is in $H^2$. Moreover, we have $g(0) = 0$ and $g'(0) = \alpha u(0) = \alpha$. 
The modulus of $g'(x) = \alpha u(x)$ is always in $[0,|\alpha|]$ for $x \in [0,3\delta]$ and it is $0$ for $x > 3\delta$; this shows that $\|g'\|_{L^2} \le |\alpha| \cdot \sqrt{3\delta}$. Further we have $|g(x)| \in [0,|\alpha|\cdot 3\delta]$ for $x \in [0,3\delta]$, and $g(x)=0$ for $x \in [3\delta,1]$, so $\|g\|_{L^2} \le |\alpha| \cdot \sqrt{3\delta}^3$. Hence, if we choose $\delta$ sufficiently small we can achieve $\|g\|_{H^1} \le 1/n$.
Finally, as $g$ vanishes on $[3\delta,1]$, we can also ensure that $g$ is zero on $[1/2,1]$ by choosing $\delta \le 1/6$. This proves the lemma.
Proof 2 (via abstract nonsense):
For people who like abstract functional analysis more than computations, here is proof which I would consider to be a bit more conceptual. It is based on the following general observation:
Proposition. Let $W$ be a normed space (not necessarily complete!) over $\mathbb{K} \in \{\mathbb{R}, \mathbb{C}\}$ and let $\varphi: W \to \mathbb{K}$ be discontinuous linear functional. Then $\ker \varphi$ dense in $W$.
Proof. First show that $\ker \varphi$ is not closed, so assume the contrary. Then the quotiend space $W / \ker \varphi$ is a normed space, the quotient map $q: W \to W/\ker \varphi$ is continuous, and $\varphi$ induces a linear map $\tilde \varphi: W/\ker \varphi \to \mathbb{K}$ such that $\varphi = \tilde \varphi \circ q$. As $W / \ker \varphi$ is one-dimensional, $\tilde \varphi$ is continuous and hence, so is $\varphi$. This contradicts our assumption.
Hence, $\ker \varphi$ is a non-closed subspace of $W$ of co-dimension $1$. As the closure of $\ker \varphi$ has to be strictly larger than $\ker \varphi$, it follows that the closure coincides with $W$. This proves the proposition.
To apply this result to the question, choose $W = H^2(0,1)$ and endow this space with the $H^1$-norm (!). Since point evaluations are continuous with respect to the $H^1$-norm, but point evaluations of derivatives are not, it follows that $\varphi: H^2(0,1) \ni u \mapsto u'(0) - u(0) \in \mathbb{K}$ is not continuous with respect to the $H^1$-norm, so $\ker \varphi$ is dense in $H^2(0,1)$ with respect to the $H^1$-norm.
Similary, we consider the functional $\psi: H^2(0,1) \ni u \mapsto u'(1) + u(1) \in \mathbb{K}$. Since $\ker \varphi$ contains all $H^2$-functions which are constantly $0$ on $[0,1/2]$, we can see that the restriction of $\psi$ to $\ker \varphi$ is also discontinuous.
Hence, $V = \ker \psi \cap \ker \varphi$ is dense (with respect to the $H^1$-norm) in $\ker \varphi$, and the latter space is dense in $H^2$ (with respect to the $H^1$-norm), and $H^2$ is dense in $H^1$. This proves that $V$ is dense in $H^1$.
Disclaimer. When we compare Proof 2 with Proof 1, one might argue that Proof 2 looks simpler only on a superficial level, since I left out that details which show that point evaluations of the derivatives are not continuous with respect to the $H^1$-norm. The main advantage that I see in Proof 2 is that it reduces the assertion to a fact for which one usually has a good intuition ("point derivatives are not continuous with respect to the $H^1$-norm") even if one does not have much experience with Sobolov spaces.
Proof 3 (form methods and the Robin Laplace operator):
I'll only sketch this argument.
Define the bilinear form $a: H^1 \times H^1 \to \mathbb{C}$ by
\begin{align*}
  a(u,v) = \int_0^1 u'(y) \overline{v'(y)} \,dy +  u(0) \overline{v(0)} + u(1) \overline{v(1)}.
\end{align*}
Then $a$ is a symmetric and coercive bilinear form which induces a self-adjoint unbounded operator $A$ on $L^2(0,1)$. One can check that $A$ is equal to $-\Delta$ with domain $D(A) = V$, i.e. $A$ is minus the Laplace operator with so-called Robin boundary conditions.
By using the spectral theorem for self-adjoint operators one can see that, for each self-adjoint operator induced by a coercive form, the domain of the operator is dense in the corresponding form domain. Hence, $V$ is dense in $H^1(0,1)$.
Reference: For details about bilinear forms and operators induced by them, see for instance the lecture notes of the 18th Internet Seminar on Evolution Equations.
A: Consider, for $m\ge2$, the function $\varphi_m(x):=x(1-x)^m$ . So 
$$\varphi_m(0)=0\qquad \varphi_m(1)=0$$ $$ \varphi_m'(0)=1\qquad  \varphi_m'(1)=0\ .$$ It is also easy to see that  $\|  \varphi_m'\|_2=O(m^{-{1/2}})$ (in fact, we may compute exactly both $\|  \varphi_m\|_2^2$ and $\| \varphi_m'\|_2^2$ in terms of some rational functions  of $m$, by means of a few Beta function integrals).
For any $v\in H^2(0,1)$ define
$$v_m(x):=v(x)+\big(v(0)-v'(0)\big)\varphi_m(x)+\big(v(1)+v'(1)\big)\varphi_m(1-x)$$
so $$v_m(0)=v(0)\qquad v_m(1)=v(1)$$ $$v_m'(0)=v(0)\qquad v_m'(1)=-v(1)$$
that is $v_m\in V$; clearly $\|v-v_m\|_{1,2}=O(m^{-{1/2}})$.
