# Let $f$ be a real valued function. Prove the set of points $x\in\mathbb{R}$ such that $F(y)\leq F(x)\leq F(z)$ for all $x\leq z$, $y\leq x$ is Borel.

Question: Let $$F:\mathbb{R}\rightarrow\mathbb{R}$$ be any function (not necessarily measurable, continuous, or anything else. Prove the set of points $$x\in\mathbb{R}$$ such that $$F(y)\leq F(x)\leq F(z)$$ for all $$x\leq z$$, $$y\leq x$$ is Borel.

This question was asked here: Prove a function is Borel set, so I am trying to go off the hint in the most recent comment, but I can't seem to quite wrap my head around it. I like what the first comment said about getting a "line" of sorts, but I just can't seem to wrap my head around what I am trying to see graphically. Any help would be greatly appreciated!

• The hint is suggesting that you show that the set in question is closed, i.e. if $x_n$ is a sequence in the set that converges to $x$, then $x$ must be in the set as well.
Commented Jun 29, 2021 at 1:07
• The hint is wrong isn't it? Consider the function $f(x) = 0$ for $x < 0$, $f(x) = 2$ for $x = 0$ and $f(x) = 1$ for $x > 0$. Then the set described would be $(-\infty, 0)$, which isn't closed (but is Borel). Or am I misunderstanding the set in question. Commented Jun 29, 2021 at 1:25
• @Vercingetorix why the interval $(0, \infty)$ (in your example) does not satisfy the description too? I'm trying to understand the set in the question.
– rose
Commented Jun 30, 2021 at 8:46

Take $$A$$ to be the complement of your set (suffices to show that this complement is Borel), i.e. $$A$$ is the set of all $$x \in \mathbb{R}$$ such that there exists either $$z > x$$ with $$F(z) < F(x)$$ or there exists $$y < x$$ with $$F(y) > F(x)$$.
If $$A$$ is empty then there's nothing to do. So suppose $$x \in A$$ and suppose first that there exists $$z > x$$ with $$F(z) < F(x)$$. Then for $$z > z' > x$$, we have $$z' \in A$$ because otherwise $$F(x) > F(z) \geq F(z') \geq F(x)$$, a contradiction. Noting that $$z$$ itself then has to be in $$A$$ also, we have then that the closed interval with endpoints $$z,x$$, i.e. $$[x,z]$$, is entirely contained in $$A$$. Likewise if there exists $$y < x$$ with $$F(y) > F(x)$$ then $$[y,x] \subseteq A$$.
From here it's easy to see that $$A$$ is a countable union of intervals. One standard way to organize this is to consider the equivalence relation $$\sim$$ on $$A$$ where we write $$x \sim y$$ with $$x,y \in A$$ if the closed interval with endpoints $$x,y$$ is entirely contained in $$A$$. Each equivalence class of $$\sim$$ on $$A$$ is a certain union of closed intervals containing some fixed point $$x$$, so is an interval in its own right. What the above paragraph implies then is that each equivalence class of $$A$$ is a nondegenerate interval, so that we can express $$A = \cup_{i \in I} J_i$$ as a disjoint union of nondegenerate intervals $$J_i$$'s. But being nondegenerate, one can pick out, for each $$i \in I$$, a rational number $$r_i \in J_i$$, giving an injection $$I \to \mathbb{Q}$$, $$i \mapsto r_i$$, so $$I$$ is countable, so $$A$$ is Borel, so your set $$\mathbb{R} \setminus A$$ is Borel.