Suppose I have some function $f:\mathbb{R}\to[0,1]$. Does there necessarily exist a bijective mapping $g:\mathbb{R}\to\mathbb{R}$ such that $g(x)\leq g(y)$ implies $f(x)≤f(y)$? If not, does it help if I restrict the domain to $\mathbb{R}_+$ or a closed interval?
Edit: I guess if I take a very ugly function such as the indicator function that is $1$ if and only if $x$ is rational, this may not hold. (In that case, let $x$ be any rational number. Whatever $g(x)$, the set $[g(x),\infty)$ has positive Lebesgue measure, but its pre-image wrt $g$ is countable.) But what about if I only need the properties to hold almost everywhere? Specifically, if the order condition holds except on a set of measure zero, if $\textsf{Im}(g)=\mathbb{R}$ up to a set of measure zero and $g^{-1}(z)$ has measure zero for all $z\in[0,1]$?
Proof idea: Here's my original intuition for what could work, but I'm not confident all arguments are sound. Let $h$ correspond to some probability measure over $\mathbb{R}$ that has full support (by which I mean, if $h(A)=0$, then the set $A$ has Lebesgue measure zero - should I rather call this absolutely continuous?) and admits a distribution function $H$. Then let $$g(x)=H^{-1}(1-h(f^{-1}((f(x),\infty)))-h(f^{-1}(\{f(x)\})\cap(x,\infty)).$$
Furthermore, let $$A=\bigcup_{n=1}^\infty\left\{\left(\frac{m}{n},\frac{m+1}{n}\right)\mid 0\leq m<n\text{ and }h\left(f^{-1}\left(\frac{m}{n},\frac{m+1}{n}\right)\right)=0\right\}.$$ Since $f^{-1}(A)$ can be written as a countable union of inverse images with zero measure each, it follows that $h(f^{-1}(A))=0$.
In that case, $f(x)<f(y)$ with $x,y\notin f^{-1}(A)$ implies $(f(x),\infty)\supseteq(f(y),\infty)\cup (\{f(y)\}\cap(x,\infty))\cup (f(x),f(y))$ and the inverse image of the last part of this disjoint union has nonzero measure by definition of $A$. This implies $g(x)<g(y)$, establishing the desired order condition.
As for bijectivity, let $z\in \mathbb{R}$. I want to show $h(g^{-1}(z))=0$. By the above, all points in $g^{-1}(z)\setminus A$ share a common function value $f(z)$. Let $(a,b)$ be the infimum and the maximum of $g^{-1}(z)$ respectively. By the definition of $g(\cdot)$, it must hold that $h(g^{-1}(z))\leq h(f^{-1}({f(z)})\cap(a,b))=0$. This establishes my notion of "almost everywhere injective".
Lastly, for surjectivity, let $k=H^{-1}(y)$ for any $y\in\mathbb{R}$. Set $z=\inf\{f(x)\mid h(f^{-1}((f(x),\infty)))<k\}$. Either $h(f^{-1}((z,\infty)))=k$ and $h(f^{-1}(\{z\}))=0$, or $h(f^{-1}((z,\infty)))>k$. Either way, there exists $x\in f^{-1}(\{z\})$ such that $g(x)=H^{-1}(k)$.
Does this sound plausible? Shouldn't there be a much more simple approach to prove this intuitive result?
If $f = 0$ you always have $fg(x) \leq fg(y)$, so such a $g$ does not always exist.