Show that a continuous function between topological vector spaces is uniformly continuous when the domain is compact Let $(E_i,\tau_i)$ be a topological vector space and $\mathcal N_{\tau_i}(x)$ denote the set of $\tau_i$-neighborhoods of $x\in E_i$.

I want to show that if $f:E_1\to E_2$ is $(\tau_1,\tau_2)$-continuous and $(E_1,\tau_1)$ is compact, then $f$ is uniformly $(\tau_1,\tau_2)$-continuous, i.e. $$\forall N\in\mathcal N_{\tau_2}(0):\exists M\in\mathcal N_{\tau_1}(0):\forall x,y\in E_1:x-y\in M\Rightarrow f(x)-f(y)\in N\tag1.$$

The idea for the proof is clear to me, but some steps need rigorous justification:

*

*Let $N\in\mathcal N_{\tau_2}(0)$.

*Since $f$ is $(\tau_1,\tau_2)$-continuous, $$\forall x\in E_1:\exists M_x\in\tau_1\cap\mathcal N_{\tau_1}(0):f(x+M_x)\subseteq f(x)+N\tag2.$$

*Since $(E_1,\tau_1)$ is compact and $\left(x+\frac{M_x}2\right)_{x\in E_1}$ is a $\tau_1$-open cover of $E_1$, there is a finite $F\subseteq E_1$ with $$\bigcup_{x\in F}\left(x+\frac{M_x}2\right)=E_1\tag3.$$

*Let $$M:=\frac12\bigcap_{x\in F}M_x$$ and $x,y\in E_1$ with $x-y\in M$.

If we could show that $$f(x)-f(y)\in N\tag4,$$ we would be done.


*By $(3)$, there is a $x_0\in F$ with $$x\in x_0+\frac{M_{x_0}}2\tag5.$$

*Now $x-y\in M\subseteq\frac{M_{x_0}}2$.

We somehow need to show that $$y=x-(x-y)\in M_{x_0}\tag6$$ and proceed from there. Can we do this?
 A: In my answer, I will replace $E_{1}$ by a compact subset $K \subseteq E_{1}$ since the uniform continuity you want holds when you restrict $f$ to any compact subset.
To start with, it's not clear that $M_{x_{0}}$ is convex so there seems to be no guarantee that $\frac{1}{2} M_{x_{0}} + \frac{1}{2} M_{x_{0}} \subseteq M_{x_{0}}$.  A way around this is since a TVS is an Abelian topological group, each neighborhood $U$ of $0$ has a subneighborhood $V \subseteq U$ satisfying
\begin{equation*}
0 \in V, \quad V = -V, \quad V + V \subseteq U.
\end{equation*}
(See here.  Munkres's Topology also has a nice section on these groups where this property is covered.)
Thus, above, given the neighborhood $M_{x}$ of the origin associated with $x$, I would have defined a corresponding neighborhood $V_{x} \subseteq M_{x}$ as above (to replace $\frac{1}{2}M_{x}$), and then defined $V$ (in place of $M$) by
\begin{equation*}
V = \bigcap_{x \in F} V_{x}
\end{equation*}
with $F$ a finite subset of $K$ satisfying $K \subseteq \cup_{x \in F} (x +V_{x})$.
Now $x \in x_{0} + V_{x_{0}}$ and $y - x \in V_{x_{0}}$ implies $y, x \in x_{0} + M_{x_{0}}$.  Therefore, $f(x), f(y) \in f(x_{0}) + N$.  You wanted $f(x) - f(y) \in N$, which is not quite what we just proved.  To get what you want, again, choose a symmetric neighborhood $\tilde{N}$ of the origin in $E_{2}$ so that $\tilde{N} + \tilde{N} \subseteq N$.  If $f(x), f(y) \in f(x_{0}) + \tilde{N}$, then
\begin{equation*}
f(x) - f(y) \in (f(x_{0}) + \tilde{N}) - (f(x_{0}) - \tilde{N}) \subseteq N.
\end{equation*}
In other words, instead of choosing $M_{x_{0}}$ so that $f(x_{0} + M_{x_{0}}) \subseteq f(x_{0}) + N$, fix $\tilde{N}$ after choosing $N$ and then choose $M_{x_{0}}$ so that $f(x_{0} + M_{x_{0}}) \subseteq f(x_{0}) + \tilde{N}$.
Again, to the best of my knowledge, this kind of "restrict to a smaller, symmetric neighborhood whose double is contained in the original one" is a standard trick for working in Abelian topological groups.
