Consider a non-injective function $f:\mathbb{R}^n\to\mathbb{R}^m$. What conditions on $f$ guarantee that the input space can be written as a collection of contours of $f$? $$ \mathbb{R}^n = \bigcup_{y\in\mathbb{R}^m} f^{-1}(\{y\}) $$ My guess is that this is true for any smooth $f$, but perhaps this is a strong condition and it is possible to relax it.
Attempted Solution
$$ \implies $$ Let $x\in\mathbb{R}^n$. Then $f(x)\in\mathbb{R}^m$ and $f^{-1}(\{f(x)\}) = \{z\in\mathbb{R}^n\,:\,f(z) = f(x)\}$. In particular $x\in f^{-1}(\{x\})$ so $\mathbb{R}^n\subseteq \bigcup_{y\in\mathbb{R}^m} f^{-1}(\{y\})$. $$ \impliedby $$ Let $z\in \bigcup_{y\in\mathbb{R}^m} f^{-1}(\{y\})$. Then necessarily $z\in f^{-1}(\{y\})$ for some $y\in\mathbb{R}^m$. By definition this means $z\in\mathbb{R}^n$
This is always true for any function $f: A \to B$. Indeed for all $a \in A$ $$a \in f^{-1}(f(a)) \subseteq \bigcup_{y \in B} f^{-1}(y)$$ Hence $$A \subseteq \bigcup_{y \in B} f^{-1}(y)$$ and the opposite inclusion is trivial.