Recently I saw an interesting lemma:

For any $s>0$, the closed unit ball in $H^s$ is also closed in the $L^2$ norm. That is, suppose $u_j\in H^s$ and $\|u_j\|_{H^s}\le 1$. Suppose $u_j\to u$ in $L^2$. Then $u\in H^s$ and $\|u\|_{H^s}\le 1$.

A possible proof of the above lemma is to take the Fourier transform and use Fatou's lemma. Another possible proof is to use Riesz representation theorem to find out successively higher derivatives of $u$ (seems to work only when $s$ is a positive integer, though).

Contemplating the above proofs, it seems to me that there is some sort of compatibility between $H^s$ and $L^2$ for the above lemma to hold. For a nonexample, it is easy to see that the closed unit ball in $C^0([0,1])$ is not closed in $L^2$ norm simply by taking a sequence of continuous functions converging in $L^2$ to $1_{[0,1/2]}$, for example.

That brings me to the question: Let $Y$ be a dense subspace of a Banach space $X$. What condition on the pair $(X,Y)$ makes the closed unit ball in $Y$ also closed in $X$? If there is no simple iff condition, is there any nontrivial sufficient/necessary condition? Among the common spaces in Analysis (e.g. Holder spaces or Sobolev spaces), is there a list of all the pairs for the above property to hold?

Thanks for your time.

completeness lemma: If the unit ball of anormedspace $X$ is closed in a Banach space $Y$ where $X$ is continuously embedded, then $X$ is also complete. A variant of this easy exercise to locally convex spaces is sometimes attributed to W. Robertson. $\endgroup$