I'm interested in the following problem on the separation of closed sets:
Let $A,B \subseteq \mathbb{R}^d$ be closed sets such that $$d(A,B) := \inf\{|x-y|; x \in A, y \in B\}>0.$$ Question: Does there exist a function $f \in C_b^k(\mathbb{R}^d)$ such that $$f^{-1}(\{0\}) = A \quad \text{and} \quad f^{-1}(\{1\})=B \tag{1}$$ ...?
Here, $C_b^k(\mathbb{R}^d)$ denotes the space of functions $f: \mathbb{R}^d \to \mathbb{R}$ with bounded derivatives up to order $k$, and $k \in \mathbb{N}$ is some fixed number.
It is a classical result that there exists a continuous function $f$ satisfying $(1)$. With a bit more effort it can be shown that there exists a smooth function $f \in C^{\infty}(\mathbb{R}^d)$ which satisfies $(1)$; this is e.g. discussed in this question.
I strongly believe that the answer to my question is "yes" but I couldn't find any results concerning the boundedness of the derivates of Urysohn function $f$. The condition $d(A,B)>0$ means intuitively that the function $f$ does not need to be arbitrarily steep, and hence it would be naturally that $f$ can be chosen in such a way that its derivates are bounded. However, it is not obvious for me how to prove this rigorously; the construction discussed in the question, which I linked above, does not seem to be helpful.
I would be happy about references and/or your thoughts on the question.
I think I managed to prove the assertion; it turns out that it is possible to construct $f \in C_b^{\infty}(\mathbb{R}^d)$ satisfying $(1)$.
As $d(A,B)>0$ we can choose $\epsilon>0$ such that the sets $$A_{\epsilon} := A+\overline{B(0,\epsilon)} \qquad B_{\epsilon} := B+\overline{B(0,\epsilon)}$$ are disjoint. According to this result, there exists $h \in C^{\infty}(\mathbb{R}^d)$, $0 \leq h \leq 1$, such that $$h^{-1}(\{0\}) = A_{\epsilon} \quad \text{and} \quad h^{-1}(\{1\})=B_{\epsilon}.$$Now let $\varphi \in C_c^{\infty}(\mathbb{R}^d)$ be such that $\text{spt} \, \varphi = \overline{B(0,\epsilon)}$, $\int \varphi(y) \, dy=1$ and $\varphi \geq 0$. Define $$f(x) := (h \ast \varphi)(x) = \int_{\mathbb{R}^d} h(y) \varphi(x-y) \, dy, \qquad x \in \mathbb{R}^d.$$ Since $f$ is the convolution of a bounded continuous function with a smooth function with compact support, it is well known that $f$ is smooth and its derivatives are given by
$$\partial_x^{\alpha} f(x) = \int_{\mathbb{R}^d} h(y) \partial_x^{\alpha} \varphi(x-y) \, dy$$
for any multi-index $\alpha \in \mathbb{N}_0^d$. This implies, in particular, $\|\partial^{\alpha} f\|_{\infty} \leq \|\partial^{\alpha} \varphi\|_{L^1}< \infty$, and so $f \in C_b^{\infty}(\mathbb{R}^d)$. Moreover, as $\text{spt} \, \varphi \subseteq \overline{B(0,\epsilon)}$, it is obvious that $f(x)=0$ for any $x \in A$ and $f(x)=1$ for $x \in B$. It remains to check that $0<f(x)<1$ for any $x \in (A \cup B)^c$. To this end, we consider several cases separately:
Consequently, we have shown that $f$ has all the desired properties.