  Let ${\mathfrak F}$ be a category of subanalytic subsets of real analytic
manifolds that is closed under basic set-theoretical and basic topological
operations. Let $M$ be a real analytic manifold and denote ${\mathfrak F}(M)$
the family of the subsets of $M$ that belong to ${\mathfrak F}$. Let
$f:X\to{\mathbb R}$ be a subanalytic function on a subset $X\in{\mathfrak
F}(M)$ such that the inverse image under $f$ of each interval of ${\mathbb R}$
belongs to ${\mathfrak F}(M)$. Let ${\rm Max}(f)$ be the set of local maxima of
$f$ and consider ${\rm Max}_\lambda(f):={\rm Max}(f)\cap\{f=\lambda\}$ for each
$\lambda\in{\mathbb R}$. If $f$ is continuous, then ${\rm
Max}(f)=\bigsqcup_{\lambda\in{\mathbb R}}{\rm Max}_\lambda(f)\in{\mathfrak
F}(M)$ if and only if the family $\{{\rm Max}_\lambda(f)\}_{\lambda\in{\mathbb
R}}$ is locally finite in $M$. If we erase continuity condition, there exist
subanalytic functions $f:X\to M$ such that ${\rm Max}(f)\in{\mathfrak F}(M)$,
but the family $\{{\rm Max}_\lambda(f)\}_{\lambda\in{\mathbb R}}$ is not
locally finite in $M$ or such that ${\rm Max}(f)$ is connected but it is not
even subanalytic. If ${\mathfrak F}$ is the category of subanalytic sets and
$f:X\to{\mathbb R}$ is a subanalytic map $f$ that maps relatively compact
subsets of $M$ contained in $X$ to bounded subsets of ${\mathbb R}$, then ${\rm
Max}(f)\in{\mathfrak F}(M)$ and the family $\{{\rm
Max}_\lambda(f)\}_{\lambda\in{\mathbb R}}$ is locally finite in $M$. If the
category ${\mathfrak F}$ contains the intersections of algebraic sets with real
analytic submanifolds and $X\in{\mathfrak F}(M)$ is not closed in $M$, there
exists a continuous subanalytic function $f:X\to{\mathbb R}$ with graph
belonging to ${\mathfrak F}(M\times{\mathbb R})$ such that inverse images under
$f$ of the intervals of ${\mathbb R}$ belong to ${\mathfrak F}(M)$ but ${\rm
Max}(f)$ does not belong to ${\mathfrak F}(M)$.
