A problem about diffeomorphism of two components of the boundary of a manifold. My geometry professor said that the following statement is true:
Let $M$ be a compact smooth manifold such that $\partial M = M_0 \cup M_1$. Suppose that there exist a smooth function $f:M \to \mathbb R$ such that $f^{-1}(i) = M_i$ for $i=0,1$. If the derivative of the function $f$ is not null at every point of $M$ then $M_0$ and $M_1$ are diffeomorphic. 
I have two questions: 
1) Is this result really true?    I didn't find any reference where it's stated.
2) If it's true, how to i prove it?
Thank you in advance.

A statement that you can adapt to your situation is:
Theorem: Let $f:M\rightarrow \mathbb{R}$ be a Morse function on a smooth manifold. Assume that $a<b$ are given such that  $f^{-1}([a,b])$ is compact and that there are no critical values $c$ with $a\leq c\leq  b$. Then $f^{-1}(a)$ and $f^{-1}(b)$ are diffeomorphic.
The keyword is Morse theory. This is the first thing (varying conditions like compactness) one proves in this direction. A standard and good reference is Milnor's aptly named Morse theory.
