Let $f\colon [a,b] \rightarrow \mathbb{R}$ be a continuous function. Prove that the function $g$, defined by $g(x)=\max \{f(t); a \leq t \leq x \}$ is uniformly continuous.
My attempt at a proof:
For $x \geq b $ $g$ is obviously constant and for $x<a$ it isn't defined. Let's first prove that $g$ is continuous on [a,b]. $$\forall x \in [a,b]:\lim_{h \searrow 0} g(x+h)=\lim_{h \nearrow 0} g(x+h)$$
$\lim_{h \searrow 0}\max \{f(t); a \leq t \leq x+h \}=\lim_{h \nearrow 0} \max \{ f(t); a \leq t \leq x \}$ because f is continuous on $[a,b]$. The same applies for the other limit, therefore the limits are the same. So $g$ is continuous on $[a,b]$.
Recall the definition of uniform continuity: $$\forall \varepsilon>0 \exists \delta>0 \forall x_1, x_2 \in D_g:(|x_1-x_2|<\delta \Rightarrow |g(x_1)-g(x_2)|<\varepsilon)$$
Because $g$ is continuous on $[a,b]$, it follows that $g$ is uniformly continuous on $[a,b]$. So if $x_1, x_2 \in [a,b] \Rightarrow (|x_1-x_2|< \delta \Rightarrow |g(x_1)-g(x_2)|< \varepsilon)$. The only other options are $x_1 \in [a,b] \wedge x_2 \in (b, \infty) $ or $x_1 \in (b, \infty) \wedge x_2 \in [a,b]$. Because the proof is analogous we will only prove the 1st case.
Let $x_1 \in [a,b] \wedge x_2 \in (b, \infty)$. We prove: $$\forall \varepsilon>0 \exists \delta>0 \forall x_1 \in [a,b] \forall x_2 \in (b, \infty): (|x_1-x_2|< \delta \Rightarrow |g(x_1)-g(x_2)|< \varepsilon)$$
Let $\varepsilon>0$ be arbitrary. Recall that $g$ is constant on $[b, \infty)$. Therefore: $$|g(x_1)-g(x_2)|=|g(x_1)-g(b)|$$
Therefore for $\delta$ we can choose the $\delta$, which assures uniform continuity on $[a,b]$, because $|g(x_1)-g(x_2)|< \varepsilon \iff |g(x_1)-g(b)|< \varepsilon$. Therefore $g$ is uniformly continuous where it's defined.
This concludes the proof.
Is this proof valid?