As stated in the above title, is there any $C^\infty$ monotonically non-decreasing function $f: \mathbb{R} \rightarrow \mathbb{R}$ such that $f((-\infty, -2]) = \{-1\}, f([2, \infty)) = \{1\}$ and $f(x) = x $ near $0$?
[My approach to this problem for now]
It is well-known that if you define $a: \mathbb{R} \rightarrow \mathbb{R}$ such that $a(t) = e^{-\frac{1}{t}} (t > 0), a(t) = 0 (t \leq 0)$, $a$ is $C^\infty$ function. So, when you define $g: \mathbb{R} \rightarrow \mathbb{R}$ as $g(t) = \frac{a(t)}{a(t) + a(1-t)}$, you can easily see that $g$ is $C^\infty$ monotonically non-decreasing function such that $g((-\infty, 0]) = \{0\}, g([1, \infty)) = \{1\}$. If you define $h: \mathbb{R} \rightarrow \mathbb{R}; t \mapsto g(t) - g(-t)$, $h$ is $C^\infty$ monotonically non-decreasing function such that $h((-\infty, -2]) = \{-1\}, h([2, \infty)) = \{1\}$. However, it seems that 「$h(t) = t$ in $(-\epsilon, \epsilon)$」does not hold for any $\epsilon > 0$. How can I go any further?
Let $$ g(x)=\left\{ \begin{array}{ccc} 0 & \text{if} & x\le 0,\\ \mathrm{e}^{-1/x^2} & \text{if} & x>0. \end{array} \right. $$ Then it is not hard to show that $g\in C^\infty(\mathbb R)$.
Next, set $$ h(x)=\int_{-\infty}^x g(t-¼)g(t+¼)\,dt. $$ Then $h\in C^\infty(\mathbb R)$, and $h(x)>0$ if $x>-¼$, while $h$ is constant, for $x\ge ¼$. Say $h(¼)=a>0$.
Next, set $j(x)=h(x+½)h(½-x)/a$. Note that the support of $j$ is
A sought for function could be one of the form $$ f(x)=-1+c\int_{-\infty}^x j(t)\,dt, $$ for a suitable $c>0$. In fact, $$ c\int_{-\infty}^x j(t)\,dt=2. $$