Application of Hahn–Banach theorem to approximation problem. Theorem 3.5. of Rudin's functional analysis states

Suppose $M$ is a subspace of a locally convex space $X$, and $x_0 \in X$. If $x_0$ is not in the closure of $M$, then there exists $\Lambda \in  X^*$ such that $\Lambda x_0 = 1$ but $\Lambda x = 0$.

And a remark below

This theorem is the basis of a standard method of treating certain approximation problems: In order to prove that an $x_0 \in X$ lies in the closure of some subspace $M$ of $X$ it is suffices (if $X$ is locally convex) to show that $\Lambda x_0 = 0$ for every continuous linear functional $\Lambda$ on $X$ that vanishes on $M$.

I'd like to see a couple of applications of this in infinite dimension vector space, but I struggle to find any.
Can anyone suggest a reference maybe? Or just show a couple of examples?
 A: A similar result is true for convex sets $M$ of a (real) locally convex space $X$, i.e., $x\in X$ belongs to the closure of $M$ if (and only if) every continuous linear functional $\Lambda$ with $\Lambda(m)\le t$ for all $m\in M$ satisfies $\Lambda(x)\le t$.
Here is a striking application which looks very elementary. Let $f_n\in C([0,1])$ be a bounded sequence of continuous functions which converges pointwise to some $f\in C([0,1])$. Then there are $\lambda_{n,k}\ge 0$ with $\sum_{k=1}^{m(n)}\lambda_{n,k}=1$ such that $\sum_{k=1}^{m(n)} \lambda_{n,k} f_k$ converges uniformly to $f$.
Here, $M$ is the convex hull of $\{f_k:k\in\mathbb N\}$ and one has to show that $f$ belongs to the closure (with respect to the uniform norm) of $M$. The Riesz representation theorem says that every $\Lambda\in C([0,1])'$ is of the form $\Lambda(g)=\int f(x)h(x)d\mu(x)$ for a finite measure $\mu$ and a bounded density $h$. Then $\Lambda(f)=\lim\limits_{n\to\infty}\Lambda(f_n)$ because of Lebegue's theorem (with a constat function as a majorization) so that $\Lambda(f_n)\le t$ for all $n\in\mathbb N$ implies $\Lambda(f)\le t$.
Edit. An application of the result for subspaces is the proof of Runge's approximation theorem for holomorphic functions by rational ones with prescribed poles as in Rudin's Functional Analysis.
