Does there exist a function $f:\mathbb{R}\rightarrow\mathbb{R}$ satisfying the following?
- $f$ is unbounded above on every open interval.
- For every $x$, there exists an open interval $S$ containing $x$ such that for all $u\in S$, $f(x)\leq f(u)$.
Does there exist a function $f:\mathbb{R}\rightarrow\mathbb{R}$ satisfying the following?
Assume $f$ is such a function.
For $n\in\mathbb N$, the set $U_n:=\{x\in\mathbb R\mid f(x)\ge n\}$ is open because by property $2$, $x\in U_n$ implies that there is an open interval $S$ with $x\in S\subseteq U_y$. Moreover, $\overline {U_n}=\mathbb R$ because for every $x\in \mathbb R$ and every open neighbourthood $U$ of $x$, property $1$ says that $U_n\cap U\ne \emptyset$. Let $$A=\bigcap_{n\in\mathbb N} U_n.$$ Then by what we have just seen, $A$ is a countable intersection of dense open sets. By the Baire category theorem, $\overline A=\mathbb R$, especially, $A\ne\emptyset$. If $a\in A$ then we find $a\in U_n$ for all $n$, that is $f(a)\ge n$ for all $n\in\mathbb N$, which is absurd.
Therefore, no such $f$ exists.