Let $f:\mathbb{R}\rightarrow\mathbb{R}$ be a continuous function on $\mathbb{R}$ such that:
$\lim_{x\to +\infty}f(x)=l\in\mathbb{R}$
$\lim_{x\to -\infty}f(x)=l'\in\mathbb{R}$
We want to show that $f$ is uniformly continuous on $\mathbb{R}$
Proof:
Let $\epsilon>0$
By the definition of limits:
$\exists\space M>0$ such that $\forall\space x>M$, $|f(x)-l|<\frac{\epsilon}{2}$
$\exists\space M'>0$ such that $\forall\space x<-M'$, $|f(x)-l'|<\frac{\epsilon}{2}$
Let $M_{0}=\max\{M,M'\}$
Consider the interval $[-M_{0},M_{0}]$
Since $f$ is continuous on $\mathbb{R}$, then $f$ is uniformly continuous on the compact set $[-M_{0},M_{0}]$
Now consider the interval $[M_{0},+\infty)$
Let $x,y\in[{M_{0},+\infty)}$, then actually $\forall\space\delta>0$ such that $|x-y|<\delta$, we have:
$|f(x)-f(y)|=|f(x)-l+l-f(y)|\le|f(x)-l|+|f(y)-l|<\frac{\epsilon}{2}+\frac{\epsilon}{2}=\epsilon$
This is true because we are working in the interval where $f$ is already converging to $l$.
So $f$ is uniformly continous on $[M_{0},+\infty)$ and since $M_{0}\in[-M_{0},M_{0}]$ and $M_{0}\in[M_{0},+\infty)$, then $f$ is uniformly continuous on $[-M_{0},+\infty)$
Now consider the interval $(-\infty,-M_{0}]$
Let $x,y\in(-\infty,-M_{0}]$, then $\forall\space\delta'>0$ such that $|x-y|<\delta'$, we have:
$|f(x)-f(y)|=|f(x)-l'+l'-f(y)|\le|f(x)-l'|+|f(y)-l'|<\frac{\epsilon}{2}+\frac{\epsilon}{2}=\epsilon$
This is true because we are working in the inteval where $f$ is already converging to $l'$.
So $f$ is uniformly continuous on $(-\infty,-M_{0}]$ and since $-M_{0}\in[-M_{0},+\infty)$ and $-M_{0}\in(-\infty,-M_{0}]$, then $f$ is uniformly continous on $\mathbb{R}$
I showed my professor this proof and he said that there is an error in logic. But he wants me to find out what it is, I can't seem to locate it. Can anyone help me out?