Using AC, one easily defines a function $F:\mathbb R\to \mathbb R$ such that the $F$image of any real interval $(a,b)$ ($a<b$) is equal to $\mathbb R$. (Equivalently, the $F$preimage of any real singleton has to be a dense set in $\mathbb R$.) Does there exist a Borelmeasurable $F$ with this property?

2$\begingroup$ en.wikipedia.org/wiki/Conway_base_13_function $\endgroup$– WojowuNov 30, 2019 at 15:44

$\begingroup$ I will just point out that such functions can be obtained even without AC, some such examples can be found in this post on MathOverflow: Function with range equal to whole reals on every open set and also in several posts on Mathematics such as this one and other questions linked there. Functions with this property are sometimes called strongly Darboux. $\endgroup$– Martin SleziakNov 30, 2019 at 16:06

$\begingroup$ Since Conway base 13 function was mentioned in the first comment, I will also add link to this question: Is Conway's base13 function measurable? $\endgroup$– Martin SleziakDec 5, 2019 at 6:34
2 Answers
This is Exercise 9.M from A. C. M. van Rooij, W. H. Schikhof: A Second Course on Real Analysis.$\newcommand{\dcc}[1]{\lfloor#1\rfloor}$
Exercise 9.M. (Another function that maps every interval onto $[0,1]$) For $x\in[0,1]$ let $0.x_1x_2x_3\dots$ be the standard dyadic development of $x\dcc x$: $$x_n=\dcc{2^n x}2\dcc{2^{n1}x}$$ where $\dcc x$ is the entire part of $x$. Define $\phi\colon{\mathbb R}\to{\mathbb R}$ by $$\phi(x)=\limsup\limits_{n\to\infty}\frac{x_1+x_2+\dots+x_n}n$$ Show that $\phi$ maps every interval onto $[0,1]$. (Hint: First show that $\phi(x)=\phi(y)$ if there exist $p,q\in\mathbb N$ such that $x_p=y_q$, $x_{p+1}=y_{q+1}$, $x_{p+2}=y_{q+2}$, etc., so that it suffices to show that $\phi$ maps $[0,1]$ onto $[0,1]$. Now let $t\in[0,1]$, $t\ne1$. Find an $x\in[0,1]$ such that $x_1+\dots+x_n=\dcc{nt}$ for every $n$ and prove that $\phi(x)=t$. Finally, find an $x$ with $\phi(x)=1$.)
The same function appears as Problem 1.3.29 in Kaczor, Nowak: Problems in Mathematical Analysis Vol II and it is given also in an answer here: Can we construct a function $f:\mathbb{R} \rightarrow \mathbb{R}$ such that it has intermediate value property and discontinuous everywhere?. The same function was also used by Andrés E. Caicedo as an example of a function which is of Baire class 2 but not of Baire class 1: Examples of Baire class 2 functions. (See also his blog post: 414/514 Examples of Baire class two functions)
As all functions $x_n$ are Borel measurable, so is the function $\phi$.
For this function, the image of a nontrivial interval is only the interval $[0,1]$. But we can get function which maps this onto reals by composition with some continuous Borel surjection from a unit interval to reals.

$\begingroup$ How can there be a continuous surjection from the compact interval $[0,1]$ to the reals? $\endgroup$ Nov 30, 2019 at 17:06

$\begingroup$ @GregoryArone You're right about that. (And I should have been more careful when writing the answer.) Luckily enough, a Borel function is enough for the requirements of the asker. (For example, we can take a continuous bijection $(0,1)\to\mathbb R$ and define values at $0$ and $1$ arbitrarily. $\endgroup$ Nov 30, 2019 at 17:11

2$\begingroup$ I have to thank everybody for comprehensive answers. A bit more complex question could be to require that the $F$preimage of every singleton be a COUNTABLE dense set. $\endgroup$ Nov 30, 2019 at 18:33
Let $\{I_n:n\in\mathbb N\}$ be the set of all open intervals with rational endpoints. Construct pairwise disjoint sets $A_n$ $(n\in\mathbb N)$ such that each $A_n$ is homeomorphic to the Cantor set and $A_n\subseteq I_n$. For each $n\in\mathbb N$ define a continuous surjection $f_n:A_n\to[n,n]$. Define $f:\mathbb R\to\mathbb R$ so that $f(x)=f_n(x)$ if $x\in A_n$ and $f(x)=x$ if $x\notin\bigcup_{n\in\mathbb N}A_n$. It's easy to see that $f$ is Borel measurable and maps every interval onto $\mathbb R$.
P.S. As Martin Sleziak pointed out in a comment the functions $f_n$ can be chosen to be at most twoto one, in which case $f^{1}(x)$ will be a countable dense set for each $x\in\mathbb R$.

$\begingroup$ If we choose the function $f_n$ in a manner similar to Devil's staircase, we get that $f^{1}(x)$ is countable for each $x\ne0$, right? (For each $x$ we get at most two preimages inside $A_n$.) I am asking this since Vladimir Kanovei mentioned in a comment that they would also be interested in an example where the fibers are countable dense sets. $\endgroup$ Dec 1, 2019 at 11:26

$\begingroup$ Sounds right. Hmm. What if we define $f(x)=x$ for $x\notin\bigcup_nA_n$? $\endgroup$– bofDec 1, 2019 at 12:06