Existence of a particular inverse transformation Let $h : \mathbb{R}^D \rightarrow \mathbb{R}^d$, where $d < D$, be a differentiable function. I would like to find minimal conditions under which there exists a differentiable function $g : \mathbb{R}^{D} \rightarrow \mathbb{R}^{D-d}$ such that the function $f : \mathbb{R}^D \rightarrow \mathbb{R}^D$ defined by $f(x)=(h(x)^\top, g(x)^\top)^\top$ is invertible. If possible, I would also like to obtain a construction of this $g$ function. I hypothesize that the following conditions might be enough, but I am not sure:
-$h$ is surjective.
-$h$ cannot have the same value on a set with non-zero measure, that is, for every $y \in \mathbb{R}^{d}$, the set $h^{-1}(\{y\})=\{x\in\mathbb{R}^D : h(x)=y\}$ has Lebesgue measure 0.
The first condition is clearly necessary, and the reason why I believe that the second condition might be enough is the following:
In order for $f$ to be invertible, $f^{-1}(\{z\})$ has to be a singleton for every $z \in \mathbb{R}^D$. If $g$ was such that $g(x_1)\neq g(x_2)$ for every $x_1$ and $x_2$ such that $h(x_1)=h(x_2)$, that would ensure that $f^{-1}(\{z\})$ is indeed a singleton for every $z \in \mathbb{R}^D$. My intuition is that the second condition might ensure that such a $g$ function actually exists. Furthermore, if such a $g$ exists that also makes $f$ surjective, the result would follow.
Any help would be very appreciated, either in proving my above conjecture, disproving it, or providing non trivial assumptions about $h$ that would result in the existence of $g$.
Thank you very much!
 A: Assume that a required function $f$ exists. Since $f$ is differentiable, it is continuous, so by the invariance of domain, $f$ is a homeomorphism. 
Then for each $t\in\Bbb R^{D-d}$ a restriction $f^{-1}|\Bbb R^{d}\times\{t\}$ is a homeomorphism onto the image $L_t=f^{-1}(\Bbb R^{d}\times\{t\})$. But $f(x)=(h(x)^\top, g(x)^\top)^\top= (h(x)^\top, t^\top)^\top$ for each $x\in L_t$. Thus $h|L_t$ is a homeomorphism onto the image. We shall call a subset $L$ of $\Bbb R^D$ an $h$-layer, if $h|L:L\to\Bbb R^d$ is a homeomorphism onto the image. Thus we have that $\Bbb R^D$ is a disjoint union of $h$-layers. 
Also for each $s\in\Bbb R^d$ a set $h^{-1}(s)=f^{-1}(\{s\}\times \Bbb R^{D-d})$ is a homeomorphic image of a space $\Bbb R^{D-d}$. 
Both conditions can fail for a function satisfying the conjecture. For instance, let $D=2$, $d=1$, and $h(x,y)=x^3-x$ for each $(x,y)\in\Bbb R^D$. Then there are no $h$ layers. Indeed, let $L$ be any connected set such that $h(L)=\Bbb R^d$. Then there exists $y_{-1}$ and $y_1$ in $\Bbb R$ such that both points $p_{-1}=(-1,y_{-1})$ and $p_1=(1,y_{1})$ belongs to $L$. But $h(p_{-1})=h(p_1)$, so $L$ is not an $h$-layer. The second condition is violated because a set $h^{-1}(0)=\{(x,y):x\in\{-1,0,1\},y\in\Bbb R\} $ is disconnected and hence not homeomorphic to $\Bbb R^{1}$.
Moreover, it can be easily checked that both partitions of $\Bbb R^D$ into $h$-layers and preimages $h^{-1}(s)$ are parallel (see [BH] for a definition) with respect to a metric $d$ such that $d(x,y)=\|f(x)-f(y)\|$ for each $x,y\in\Bbb R^D$. Then similarly to the proof of the implication $(1)\Rightarrow (2)$ in Theorem 1 from [BH] we can show that each of these partitions $\mathcal C$ is lower semicontinuous and compactly upper semicontinuous. The latter means that for each compact subset $F$ of $\Bbb R^D$ its $\mathcal C$-star $St(F;\mathcal C)$ is closed in $\Bbb R^D$.
I guess that we can strengthen the above necessary conditions, if we define an $h$-layer $L$ as a submanifold of $\Bbb R^D$ such that $h|L$ is a diffeomorphism and require that a set $h^{-1}(s)$ for $s\in\Bbb R^d$ is a submanifold and a diffeomorphic image of a space $\Bbb R^{D-d}$. But I didn’t investigate this topic because I am a general topologist, not a differential one.
References 
[BH] Taras Banakh, Olena Hryniv, A parallel metrization theorem, 
European Journal of Mathematics (2019), 1-4.
