I have a theorem that says that:
Theorem : Let $M,N$ smooths manifolds and $f:M\to N$ a smooth application.
If $Rg(f)=k$ in a neighborhood of $S=f^{-1}(q), q\in N$ then $S$ is a submanifold of dimension $n-k$.
Then, I have a remark that says that if $Rg(f,x)=k$ for all $x\in S$, we can't conclude that $S$ is a smooth manifold. I recall that $Rg(f,x)=Rg(d_xf).$
My question : So if I understand well, if $Rg(f,x)=k$ for all $x\in S$, then we can't conclude that $S$ is a submanifold, but if there is an open $U\supset S$ s.t. $Rg(f,x)=k$ for all $x\in U$, then $S$ is a submanifold of dimension $n-k$. Did I understand well ?
Yes. For a simple example demonstrating this point, consider your favorite smooth bump function
$$ f(x) = \begin{cases} e^{-\frac{1}{1-x^2}} & |x| < 1, \\ 0 & |x| \geq 1. \end{cases} $$
Then $f^{-1}(0) = \{ x \, | \, |x| \geq 1 \}$ and for all $x \in f^{-1}(0)$ we have $f'(x) = 0$. So $df$ is of constant rank $0$ on $f^{-1}(0)$ but $f^{-1}(0)$ is not a $1 - 0 = 1$ dimensional submanifold of $\mathbb{R}$.