Let $E$ be a t.v.s. and $f$ linear. Is is true that $\{x \in E \mid f(x) = \alpha\}$ is closed implies $f$ is continuous?

This is a lemma used in the proof of Hahn-Banach theorem in normed vector space.

Let $E$ be a real vector space, $f:E \to \mathbb R$ linear and not constant, and $\alpha \in \mathbb R$. Then $H =\{x \in E \mid f(x) = \alpha\}$ is called an affine hyperplane. If $E$ is a normed vector space, then $H$ is closed if and only if $f$ is continuous.

The proof relies on the fact that every neighborhood $V$ of $x \in E$ contains an open ball (which is convex) centered at $x$.

I would like to ask if the lemma holds if we relax $E$ to be a topological vector space. If not, please give a counter-example.


One implication is trivial; for the other, if $H$ is closed, then, given $v\in H$, $\ker f=H-v$ is closed because translations are homeomorphisms. So $E/\ker f$ is a Hausdorff one-dimensional topological vector space, and so it's homeomorphically isomorphic to $\mathbf{R}$.

$f$ factorizes through $E/\ker f$: $$E\to E/\ker f\to \mathbf{R}$$ and it's continuous because it's composition of two continuous maps.