Critical values of analytic functions of several variables Let $f:\mathbb{R}^d\to \mathbb{R}$ be real analytic. Define $S=\{x\in\mathbb{R}^d, \nabla f (x)=0\} $. Is it true that for any compact set $K\subset \mathbb{R}^d$, $f(S\cap K)$ is a finite set ?
 A: One can assume that $K$ is a cube, by enlarging it. Then $S \cap K$ is a bounded definable set in the $o$-minimal structure $\mathbb{R}^{\mathrm{an}}$ (obtained by adding restricted analytic function, cf this paper). 
By the Yomdin-Gromov parametrization lemma, there exists a finite family $(\phi_i : ]0,1[^{d_i} \rightarrow S \cap K)_{i \in I}$ of differentiable functions whose images cover $S \cap K$.
For each $i$, the function $f \circ \phi_i$ is differentiable with vanishing differential, so that $f \circ \phi_i = c_i$ for some constant $c_i$.
Thus $f(S \cap K) \subseteq \{ c_i  \ | \ i \in I \}$ is a finite set. 
EDIT: I just realized one could avoid the use of the Yomdin-Gromov parametrization lemma. Namely, $f(S \cap K)$ is a definable subset of $\mathbb{R}$ wrt the aforementioned o-minimal structure. It is therefore a finite union of points and intervals. Since it has zero Lebesgue measure by Morse-Sard's theorem, it must consist of finitely many points.
A: Yes. For another approach, see "Morse-Sard theorem for real-analytic functions" by Jiří Souček and Vladimír Souček. (Commentationes Mathematicae Universitatis Carolinae, Vol. 13 (1972), No. 1, 45--51)
