  The Pr\"ufer rank $\mathrm{rk}(G)$ of a profinite group $G$ is the supremum,
across all open subgroups $H$ of $G$, of the minimal number of generators
$\mathrm{d}(H)$. It is known that, for any given prime $p$, a profinite group
$G$ admits the structure of a $p$-adic analytic group if and only if $G$ is
virtually a pro-$p$ group of finite rank. The dimension $\dim G$ of a $p$-adic
analytic profinite group $G$ is the analytic dimension of $G$ as a $p$-adic
manifold; it is known that $\dim G$ coincides with the rank $\mathrm{rk}(U)$ of
any uniformly powerful open pro-$p$ subgroup $U$ of $G$.
  Let $\pi$ be a finite set of primes, let $r \in \mathbb{N}$ and let
$\mathbf{r} = (r_p)_{p \in \pi}, \mathbf{d} = (d_p)_{p \in \pi}$ be tuples in
$\{0, 1, \ldots,r\}$. We show that there is a single sentence
$\sigma_{\pi,r,\mathbf{r},\mathbf{d}}$ in the first-order language of groups
such that for every pro-$\pi$ group $G$ the following are equivalent: (i)
$\sigma_{\pi,r,\mathbf{r},\mathbf{d}}$ holds true in the group $G$, that is, $G
\models \sigma_{\pi,r,\mathbf{r},\mathbf{d}}$; (ii) $G$ has rank $r$ and, for
each $p \in \pi$, the Sylow pro-$p$ subgroups of $G$ have rank $r_p$ and
dimension $d_p$.
  Loosely speaking, this shows that, for a pro-$\pi$ group $G$ of bounded rank,
the precise rank of $G$ as well as the ranks and dimensions of the Sylow
subgroups of $G$ can be recognized by a single sentence in the first-order
language of groups.
