Let $E$ be a t.v.s. and $f$ linear. The hyperplane $\{x \in E \mid f(x) = \alpha\}$ is closed if and only if $f$ is continuous

This proposition is proved in case $E$ is a normed vector space. I'm trying to generalize it to topological vector space. Could you have a check on my attempt?

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 real topological vector space, then $H$ is closed if and only if $f$ is continuous.

My attempt: The direction $\implies$ is clear. Let's prove the reverse. Assume that $H$ is closed and thus $H^c$ is open. Because $f$ is not constant, there exist $a \in H^c$ and an open neighborhood $U$ of $0_E$ such that $U +a \subseteq H^c$.

Consider the map $T:\mathbb R \times E \to E, (t, x) \mapsto tx$. Clearly, $T$ is continuous. Then there open neighborhoods $V_1$ of $0_{\mathbb R}$ and $V_2$ of $0_E$ such that $T (V_1 \times V_2) \subseteq U$. There is $t_1 >0$ such that $I := (-t_1, t_1) \subseteq V_1$. Then $U' := \bigcup_{t \in I} t V_2 \subseteq U$ is a symmetric neighborhood of $0_E$, i.e., $U' = - U'$. WLOG, we assume $U' = U$.

We claim that $f(U)$ is unbounded. If not, for each $M \in \mathbb R$, there is $x_M \in U$ such that $|f(x_M) |> M$. Then $(-M, M) \subseteq f(Ix_M)$ and thus $f(U) = \mathbb R$. So there is $b \in U$ such that $f(b + a) = \alpha$, which is a contradiction. So $f(U)$ is bounded. Hence there is $t_2 >0$ such that $f(U) \subseteq (-t_2, t_2)$.

Let $N := (-t_3, t_3)$ be a neighborhood of $0_\mathbb R$. Then $f \left (\frac{t_3}{t_2}U \right) \subseteq N$. It follows that $f$ is continuous at $0_E$ and hence $f$ is continuous.


The proof is correct: indeed if $u\in U'$ then $u\in tV_2$ for any $t\in(-t_1,t_1)$ so that $u=tv_2$ for any $v_2\in V_2$ and thus we conclude that $$ -u=-tv_2\in -tV_2\subseteq U' $$ which implies that $U'$ is symmetric; moreover $U'\subseteq U$ and both are neighborhood of $0_E$ so that $U'+a$ and $U+a$ are both neighborhood of $a$ such that $$ U'+a\subseteq U+a\subseteq H^c $$ and thus without loss of generality we can assume that $U'$ is exactly equal to $U$; moreover since $f[U]=\Bbb R$ then $$ f[U+a]=f[U]+f[a]=\Bbb R+\alpha=\Bbb R $$ so that there exist $b\in U+a$ such that $$ f(b+a)=\alpha $$ as you stated; finally by the linearity of $f$ we conclude that $$ f\biggl[\frac{t_3}{t_2}U\biggl]=\frac{t_3}{t_2}\cdot f[U]\subseteq\frac{t_3}{t_2}\cdot(-t_2,t_2)=(-t_3,t_3) $$ and so $f$ is continuous.

So your proof is valid for any t.v.s, even for t.v.s of infinite dimesion.

Anyway if the dimesion of $E$ was finite I point out you can also prove the statement (if you like) using the following arguments.

In the text Functional Analysis Walter Rudin shows that any linear function between t.v.s. of finite dimension is continuous so that your statement follows immediately remembering that if $f:X\rightarrow Y$ is a function between topological spaces then it is continuous if and only if the preimage of a closed set of $Y$ under $f$ is a closed set of $X$.