Confusion about definition of uniformly continuous function In my analysis course, when we had to demonstrate that continuous function are Riemann integrable, my professor introduced the concept of uniformly continuous function. On that day he gave this definition:

A function $f:\ I \to \Bbb R $ is uniformly continuous if $\exists \ \omega:\ [0,+\infty[ \ \rightarrow \Bbb R^+$ continuous and increasing with $\omega(0)=0$ such that $\forall \ x,y \in I \quad |f(x)-f(y)|\leq\omega(|x-y|)$$\tag{1}\label{1}$

From this fact he demonstrate that all uniformly continuous function are continuous. There is the proof:
$\forall \ x_0 \in I \ \forall \ \epsilon > 0$ we pick $\delta$ such that $\omega(\delta)\leq\epsilon$ (this is possible due to the continuity of $\omega$). We have that $|f(x)-f(x_0)|\leq\omega(|x-x_0|)\leq\omega(\delta)\leq \epsilon$
After some lesson he returned to the argument in order to proof that continuous function over a compact set are also uniformly continuous. This time the definition he gave was a little different and that confused me:

A function $f:\ E \to G $ ($E,G$ metric spaces) is uniformly continuous if $\exists \ \omega:\ [0,+\infty[ \ \rightarrow \Bbb R^+$ continuous in  0 and increasing with $\omega(0)=0$ such that $\forall \ x,y \in E \quad d_E(f(x),f(y))\leq\omega(d_G(x,y))$$\tag{2}\label{2}$

Of course I think that this definition is a sort of generalization but I cannot understand why this time we need continuity only in 0. Anyway we had never used the fact that it is continuous everywhere but only that is continuous in 0. Since I was confused by these different definitions I have looked up in my book the definition of uniformly continuous function and I have find out (searching also on the web) that the standard definition is this one:

A function $f:\ E \to G $ ($E,G$ metric spaces) is uniformly continuous if $\forall \ \epsilon>0 \ \exists \ \delta>0$ such that $\forall \ x,y \in E \quad d_G(x,y)\leq \delta \ \implies \ d_E(f(x),f(y))\leq \epsilon$$\tag{3}\label{3}$

My question is: Why in the $\ref{2}$ definition we only need that $\omega$ is continuous in 0? Are the $\ref{2}$ and $\ref{3}$ definition the same? If yes how can we prove it? Thank you very much in advance!
 A: Let $(X, d_X)$ and $(Y, d_Y)$ denote two metric spaces. 
Fix a function $f: X \to Y$ and suppose there exists an extended real-valued function $\omega: [0,\infty] \to [0,\infty]$ that satisfies
\begin{align}
&(1) \quad \omega(0) = 0 \\[6pt] 
&(2) \quad \lim_{t \to 0}\omega(t) = 0 \\
&(3) \quad d_Y(f(x),f(x')) \leq \omega(d_X(x,x'))
\end{align}
for all $x,x' \in X$. Now pick $\epsilon > 0$. 
By (1) and (2), there exists $\delta > 0$ such that $\omega(t) \in [0,\epsilon)$ for all $t \in [0,\delta)$.
But then for all $x,x' \in X$ satisfying $d_X(x,x') < \delta$, we can apply (3) to conclude
$$
d_Y(f(x),f(x')) < \epsilon 
$$
Conversely, suppose for any $\epsilon > 0$, there exists $\delta > 0$ such that 
$$
(4)\quad d_X(x,x') < \delta \implies d_Y(f(x),f(x')) < \epsilon 
$$
for all $x, x' \in X$.
Define the extended real-valued function $\omega:[0,\infty] \to [0, \infty]$ as
$$
(5) \quad \omega(t) = 
\sup\{d_Y(f(x), f(x')): x,x' \in X \text{ and } d_X(x,x') \leq t\}
$$
The set on the right-hand side of (5) includes 0 for any $t \geq 0$, so $\omega(\cdot)$ is well-defined.
We also have
1) $\omega(0) = 0$ by the identity of indiscernibles property of metrics
2) Fix $\epsilon > 0$ and choose $\delta > 0$ that satisfies (4). Then for all $t \in (0,\delta)$, we have $\omega(t) \leq \epsilon$. Therefore $\lim_{t \to 0} \omega(t) = 0$
3) $\omega(\cdot)$ satisfies (3) by construction
We conclude that the two definitions are equivalent.
