Are strict local minima of a general function always countable?

This came up as a question in my last real analysis test. Speaking to my teacher after the test, he said he'd forget to mention that the function should be continuous, and in fact there is an easy couterexample for his argument when the function is not continuous. Still after thinking for a long time I was unable to come up with a function with uncoutable strict local minima or with a proof that these don't exist.


Let $M$ be the set of strict local minima of a function $f$. Then for every $p\in M$ there is an open interval $(a,b)$ such that $f(p)$ is smaller than $f(x)$ for any $x\in(a,b)\setminus\{p\}$. We can now choose rational numbers $a_p,b_p$ with $a<a_p<p<b_p<b$, and $f(p)$ will be the smallest value on $(a_p,b_p)$.

Define a map $g:M\rightarrow\Bbb Q^2$ taking $p$ to a pair $(a_p,b_p)\in\Bbb Q^2$ like above (we don't need choice; we can choose $(a_p,b_p)$ to be the least working pair in some well-ordering of $\Bbb Q^2$). It's clear $g$ is injection, since $f(x),f(y)$ cannot both be smaller than each other for $x\neq y$. Hence $g$ is an injection into a countable set showing $M$ is countable.