If $f(x)$ is continuous at the closed interval $[a,b]$, and $\forall x_0\in [a,b]$, there is an open interval $U$ containing $x_0$ s.t. $f(x_0)$ is none bigger than $f(\eta)$ for any $\eta\in U$, then prove that $f$ is constant on $[a,b]$.
I think that if we can prove for all $x\in[a,b]$, there is an open interval containing $x$ and $f$ is constant on that interval, then we can use Heine-Borel theorem to prove the statement. But how to prove for all $x$ there is an open interval containing $x$ and $f$ is constant on that interval?