The following theorem is stated in Spivak's "Calculus on Manifolds" as a follow-up on the Implicit Function Theorem:
Theorem 2.13: Let $f: \mathbb{R}^n \to \mathbb{R}^p$ be continuously differentiable in an open set containing $a$, where $p \le n$. if $f(a) = 0$ and the $p \times n$ matrix $(D_jf_i(a))$ has rank $p$, then there is an open set $A \subset \mathbb{R}^n$ containing $a$ and a differentiable function $h: A \to \mathbb{R}^n$ with differentiable inverse such that
$f \circ h (x^1, \dots, x^n) = (x^{n-p+1}, \dots, x^n).$
I don't see how this can be true. For a simple counter-example, let $f(x) = \sin(x)$ with $n=p=1$. Since $f'(2\pi)=1$, the theorem should hold at $a = 2\pi$, and since $a \in A$ we get for $x = a = 2\pi$:
$\sin(h(a)) = a = 2\pi,$
which cannot be true for any $h$. Where is the mistake?