$\displaystyle\int_{\pi_{o}^{-1}(\tilde{\pi}\operatorname{\circ}f)}F_{1}^{\prime}\big{(}f(v)(t\operatorname{\circ}\operatorname{\Psi}_{v})\big{)}\;F_{2}^{\prime\prime}(t\operatorname{\circ}\operatorname{\Psi}_{v})\,\mathrm{d}\mu_{\tilde{\pi}\operatorname{\circ}f}(t),$

where
$F_{2}^{\prime\prime}(t\operatorname{\circ}\operatorname{\Psi}_{v})=\int_{t^{\prime}\in
Q_{t}}F_{2}^{\prime}(t^{\prime})\,\mathrm{d}\mu_{Q_{t}}(t^{\prime})$ is a
continuous function of
$\operatorname{c}=t\operatorname{\circ}\operatorname{\Psi}_{v}\in\operatorname{C}^{k}(\operatorname{X})$,
by Definition 2.1. We can now use the fact that $t\mapsto
t\operatorname{\circ}\operatorname{\Psi}_{v}$ is measure-preserving from
$\pi_{o}^{-1}(\tilde{\pi}\operatorname{\circ}f)$ to
$\pi^{-1}(\tilde{\pi}\operatorname{\circ}f(v))$, to conclude that for $f(v)\in
M$ we have

$\varphi_{F_{1}^{\prime},F_{2}^{\prime}}(\phi_{v,f})=\int_{\pi^{-1}(\tilde{\pi}\operatorname{\circ}f(v))}F_{1}^{\prime}\big{(}f(v)(\operatorname{c})\big{)}\;F_{2}^{\prime\prime}(\operatorname{c})\,\mathrm{d}\mu_{\tilde{\pi}\operatorname{\circ}f}(\operatorname{c}).$

This is of the form $\varphi_{F_{1}^{\prime},F_{2}^{\prime\prime}}(f(v))$ as
in (15), and the continuity of $\phi_{v}$ follows.
The continuity of each function $\phi_{v}$ implies that the following function
is continuous:

$\displaystyle\phi_{1}\;:\;\;R_{k}(M)$ $\displaystyle\quad\to\quad$
$\displaystyle
L\big{(}\pi_{o}^{-1}(\tilde{\pi}\operatorname{\circ}f),\operatorname{Z}^{\\{0,1\\}^{k}}\big{)}\;\subset\;\mathcal{L}(Q,\operatorname{Z}^{\\{0,1\\}^{k}})$
$\displaystyle f$ $\displaystyle\quad\mapsto\quad$
$\displaystyle\phi_{1,f}(t)=(f(v)(t\operatorname{\circ}\operatorname{\Psi}_{v}))_{v\in\\{0,1\\}^{k}}.$

Indeed, if $f_{n}\to f$ in $R_{k}(M)$ then for each $v$ by continuity of
$\phi_{v}$ we have $\phi_{v,f_{n}}\to\phi_{v,f}$ in
$\operatorname{\mathcal{L}}(Q,\operatorname{Z})$. This then implies that
$\phi_{1,f_{n}}\to\phi_{1,f}$ in
$\operatorname{\mathcal{L}}(Q,\operatorname{Z}^{\\{0,1\\}^{k}})$, by Lemma
3.9.
The proof can now be completed using Lemma 3.15. Indeed, for $P=\\{0,1\\}^{k}$
and appropriate choices of coefficients $\lambda_{r}$ in that lemma, the
original function
$\phi:R_{k}(M)\to\operatorname{\mathcal{L}}(Q,\operatorname{Z})$ is the
composition $\Sigma_{P}\operatorname{\circ}\phi_{1}$. The lemma tells us that
$\Sigma_{P}$ is continuous, and so $\phi$ is continuous. ∎

Recall from [8, Lemma 3.3.28] that, up to isomorphisms of nilspaces, every
extension of $\operatorname{X}$ by $\operatorname{Z}$ is of the form $M(\rho)$
above for some cocycle $\rho$. We now want an analogue of this result for
compact nilspaces, which requires that the isomorphism be also a
homeomorphism. To ensure this, recall first from [8, Lemma 3.3.21] that given
a degree-$k$ extension of a nilspace, every cross section $\operatorname{s}$
for this extension generates a cocycle, denoted $\rho_{\operatorname{s}}$. We
now show that for compact nilspaces one can take $\rho_{\operatorname{s}}$ to
be Borel measurable.

######  Lemma 4.5.

Let $\operatorname{X}$ be a compact nilspace, and let $\operatorname{Y}$ be a
compact nilspace that is a degree-$k$ extension of $\operatorname{X}$ by a
compact abelian group $\operatorname{Z}$. Then there is a Borel cross section
$\operatorname{s}$ for this extension and therefore a Borel cocycle
$\rho_{\operatorname{s}}:\operatorname{C}^{k+1}(\operatorname{X})\to\operatorname{Z}$.

###### Proof.

Let $\pi:\operatorname{Y}\to\operatorname{X}$ be the projection of the
extension. Let
$P=\\{(x,y)\in\operatorname{X}\times\operatorname{Y}\,:\,\pi(y)=x\\}$. A
cross-section for $\pi$ is a subset of $P$ which happens to be the graph of a
function $\operatorname{X}\to\operatorname{Y}$. Let
$\mathcal{P}(\operatorname{Y})$ denote the set of Borel probability measures
on $\operatorname{Y}$. By [28, Corollary 18.7], a sufficient condition for a
Borel cross section to exist is that for some Borel function
$\mu:\operatorname{X}\to\mathcal{P}(\operatorname{Y})$ we have
$\mu_{x}(P\cap(\\{x\\}\times\operatorname{Y}))>0$. The measures $\mu_{x}$ from
the CSM structure on $\pi$ satisfy this, and the function $x\to\mu_{x}$ is
continuous, by Definition 2.1. There is therefore a Borel cross section
$\operatorname{s}:\operatorname{X}\to\operatorname{Y}$. We can then define a
Borel function
$\rho:\operatorname{C}^{k+1}(\operatorname{Y})\to\operatorname{Z}$ by
$\rho(\operatorname{c}^{\prime})=\sigma_{k+1}(\operatorname{s}\operatorname{\circ}\pi\operatorname{\circ}\operatorname{c}^{\prime}-\operatorname{c}^{\prime})$.
Moreover, as is shown in the proof of [8, Lemma 3.3.21], the function $\rho$
is constant on each fibre of the map
$\operatorname{C}^{k+1}(\operatorname{Y})\to\operatorname{C}^{k+1}(\operatorname{X})$,
$\operatorname{c}^{\prime}\mapsto\pi\operatorname{\circ}\operatorname{c}^{\prime}$,
thus yielding the well-defined cocycle
$\rho_{\operatorname{s}}:\operatorname{C}^{k+1}(\operatorname{X})\to\operatorname{Z}$.
It can then be seen by general results that $\rho_{\operatorname{s}}$ is also
Borel measurable. For instance, one can use that by [8, Definition 3.3.13] the
space $\operatorname{C}^{k+1}(\operatorname{Y})$ is a continuous abelian
bundle over $\operatorname{C}^{k+1}(\operatorname{X})$ with Polish structure
group
$\operatorname{C}^{k+1}(\operatorname{\mathcal{D}}_{k}(\operatorname{Z}))$, so
that by [28, Theorem (12.16) and Corollary (15.2)] there is a Borel cross
section $\operatorname{c}\mapsto\operatorname{c}^{\prime}$ for this bundle. ∎

We shall also need the following useful generalization of a classical
automatic-continuity result. The classical result in question is a theorem of
Kleppner stating that a Borel measurable homomorphism between two locally
compact groups must be continuous [29, Theorem 1]. We extend the case of
compact abelian groups as follows.

######  Theorem 4.6.

Let $\operatorname{X},\operatorname{Y}$ be compact nilspaces of finite step,
and let $\phi:\operatorname{X}\to\operatorname{Y}$ be a Borel measurable
morphism. Then $\phi$ is continuous.

###### Proof.

Suppose that $\operatorname{Y}$ is a $(k-1)$-step nilspace, and consider the
CSM on $\pi:\operatorname{C}^{k}(\operatorname{X})\to\operatorname{X}$,
$\operatorname{c}\mapsto\operatorname{c}(0^{k})$, given by Lemma 2.17. For
each $v\in\\{0,1\\}^{k}\setminus\\{0^{k}\\}$ let
$\pi_{v}:\operatorname{C}^{k}(\operatorname{X})\to\operatorname{X}$,
$\operatorname{c}\mapsto\operatorname{c}(v)$. We have that $\pi_{v}$ is
continuous and each of its restrictions to a space
$\operatorname{C}^{k}_{x}(\operatorname{X})$ is measure-preserving, by Lemma
2.14 (applied with $P_{1}=\\{0^{k}\\}$, $P_{2}=\\{v\\}$ and $f:0^{k}\mapsto
x$, identifying $\hom_{f|_{P_{1}\cap P_{2}}}(P_{2},\operatorname{X})$ with
$\operatorname{X}$). Now for each $v$ let
$f_{v}:\operatorname{X}\to\operatorname{\mathcal{L}}(\operatorname{C}^{k}(\operatorname{X}),\operatorname{Y})$
be the function sending $x$ to the restriction
$\phi\operatorname{\circ}\pi_{v}|_{\operatorname{C}_{x}^{k}(\operatorname{X})}$.
Then $f_{v}$ is continuous, by Lemma 3.14 (applied with
$V=\operatorname{C}^{k}(\operatorname{X})$, $W=K=\operatorname{X}$,
$f_{1}=\pi_{v}$ and $f_{2}=\phi$).
Let
$f:\operatorname{X}\to\operatorname{\mathcal{L}}\big{(}\operatorname{C}^{k}(\operatorname{X}),\operatorname{Y}\big{)}$
be the function mapping $x\in\operatorname{X}$ to the constant function with
value $\phi(x)$ on $\operatorname{C}_{x}^{k}(\operatorname{X})$. From the
definition of
$\operatorname{\mathcal{L}}\big{(}\operatorname{C}^{k}(\operatorname{X}),\operatorname{Y}\big{)}$
it follows that if $f$ is continuous then so is $\phi$.
To see that $f$ is continuous, recall that
$\operatorname{Cor}^{k}(\operatorname{Y})$ denotes the space of $k$-corners on
$\operatorname{Y}$ and consider the following function:

$\xi:\operatorname{X}\to\operatorname{\mathcal{L}}\big{(}\operatorname{C}^{k}(\operatorname{X}),\operatorname{Cor}^{k}(\operatorname{Y})\big{)},\;\;\;x\mapsto\;\;\Big{(}\xi_{x}:\operatorname{c}\in\operatorname{C}^{k}_{x}(\operatorname{X})\;\mapsto\;\big{(}f_{v}(x)(\operatorname{c})\big{)}_{v\neq
0^{k}}=\big{(}\phi\operatorname{\circ}\operatorname{c}(v)\big{)}_{v\neq
0^{k}}\Big{)}.$

Combining the continuity of each function $f_{v}$ with Lemma 3.9, we deduce
that $\xi$ is continuous. Now let $\operatorname{\mathcal{K}}$ denote the
function
$\operatorname{\mathcal{L}}\big{(}\operatorname{C}^{k}(\operatorname{X}),\operatorname{Cor}^{k}(\operatorname{Y})\big{)}\to\operatorname{\mathcal{L}}\big{(}\operatorname{C}^{k}(\operatorname{X}),\operatorname{Y}\big{)}$
that sends a function $g$ to $\operatorname{K}\operatorname{\circ}g$, where
$\operatorname{K}:\operatorname{Cor}^{k}(\operatorname{Y})\to\operatorname{Y}$
is the unique completion of $k$-corners on $\operatorname{Y}$. By Lemma 1.12
we know that $\operatorname{K}$ is continuous, and we claim that
$\operatorname{\mathcal{K}}$ is therefore continuous. Indeed, suppose we have
a sequence $g_{n}$ in
$\operatorname{\mathcal{L}}\big{(}\operatorname{C}^{k}(\operatorname{X}),\operatorname{Cor}^{k}(\operatorname{Y})\big{)}$
converging to $g$, and let $F_{1}:\operatorname{Y}\to\mathbb{C}$ and
$F_{2}:\operatorname{C}^{k}(\operatorname{X})\to\mathbb{C}$ be continuous.
Then

$\varphi_{F_{1},F_{2}}(\operatorname{\mathcal{K}}(g_{n}))\;=\;\int_{\operatorname{C}^{k}_{x_{n}}(\operatorname{X})}F_{1}(\operatorname{K}\operatorname{\circ}g_{n}(\operatorname{c}))\;F_{2}(\operatorname{c})\;\,\mathrm{d}\mu(\operatorname{c})\;=\;\varphi_{F_{1}\operatorname{\circ}\operatorname{K},F_{2}}(g_{n}),$

where $\varphi_{F_{1}\operatorname{\circ}\operatorname{K},F_{2}}$ is one of
the functions generating the topology on
$\operatorname{\mathcal{L}}(\operatorname{C}^{k}(\operatorname{X}),\operatorname{Cor}^{k}(\operatorname{Y}))$.
Hence by assumption this converges to
$\varphi_{F_{1}\operatorname{\circ}\operatorname{K},F_{2}}(g)=\varphi_{F_{1},F_{2}}(\operatorname{\mathcal{K}}(g))$,
so $\operatorname{\mathcal{K}}$ is continuous.
Finally, note that $f=\operatorname{\mathcal{K}}\operatorname{\circ}\,\xi$, so
$f$ is continuous, which completes the proof. ∎

We are now able to prove the analogue of [8, Lemma 3.3.28] for compact
nilspaces.

######  Lemma 4.7.

Let $\operatorname{X}$ be a compact nilspace of finite step. Let
$\operatorname{Y}$ be a degree-$k$ extension of $\operatorname{X}$ by a
compact abelian group $\operatorname{Z}$. Let
$\operatorname{s}:\operatorname{X}\to\operatorname{Y}$ be a Borel cross-
section and let $\rho=\rho_{\operatorname{s}}$ be the associated Borel
cocycle. Then $\operatorname{Y}$ is isomorphic as a compact nilspace to the
extension $M(\rho)$ from Proposition 4.2.

###### Proof.

Let $\pi:\operatorname{Y}\to\operatorname{X}$ be the projection for the
extension. The isomorphism is given by the following map:

$\theta:\operatorname{Y}\to
M,\;\;x\mapsto\rho_{\pi(x)}+(x-\operatorname{s}\operatorname{\circ}\pi(x)).$
(16)

It is checked in the proof of [8, Lemma 3.3.28] that $\theta$ is an
isomorphism of nilspaces. Since $\operatorname{Y}$ and $M$ are both compact
Hausdorff spaces, if we show that $\theta$ is continuous then it is a
homeomorphism [32, Theorem 26.6]. Since $\theta$ is Borel measurable, it is
continuous by Theorem 4.6. ∎

Recall from [8, Subsection 3.3.3] that
$H_{k}(\operatorname{X},\operatorname{Z})$ denoted the quotient of the abelian
group of degree-$k$ cocycles by the subgroup of coboundaries. In the category
of compact nilspaces we restrict these groups to the Borel measurable
cocycles. Combining the results from this section, we now deduce the following
analogue of [8, Corollary 3.3.29] for compact nilspaces.

######  Corollary 4.8.

Let $\Phi$ denote the map which sends each class $C\in
H_{k}(\operatorname{X},\operatorname{Z})$ to the isomorphism class of
$M(\rho)$, for any choice of $\rho\in C$. Then $\Phi$ is a surjection from
$H_{k}(\operatorname{X},\operatorname{Z})$ to the set of isomorphism classes
of compact degree-$k$ extensions of $\operatorname{X}$ by $\operatorname{Z}$.

The proof is similar to that of [8, Corollary 3.3.29].

###  5 Compact abelian bundles of finite rank, and averaging

In this section we define a notion of rank for compact abelian bundles and
nilspaces, and we give a first topological description of nilspaces of finite
rank (Lemma 5.3). We then define an averaging operation for certain functions
on these spaces, which enables us to prove a useful rigidity result concerning
cocycles (Lemma 5.7).

######  Definition 5.1.

Let $\operatorname{B}$ be a $k$-fold compact abelian bundle, with structure
groups $\operatorname{Z}_{1},\dots,\operatorname{Z}_{k}$. We define the _rank_
of $\operatorname{B}$ by

$\mathrm{rk}(\operatorname{B})=\sum_{i=1}^{k}\mathrm{rk}(\widehat{\operatorname{Z}_{i}})$

where $\widehat{\operatorname{Z}_{i}}$ is the Pontryagin dual of
$\operatorname{Z}_{i}$ and $\mathrm{rk}(\widehat{\operatorname{Z}_{i}})$ is
the minimal number of generators of $\widehat{\operatorname{Z}_{i}}$. If
$\operatorname{X}$ is a $k$-step compact nilspace then we define its rank
$\mathrm{rk}(\operatorname{X})$ to be $\mathrm{rk}(\operatorname{B})$ for the
associated bundle $\operatorname{B}$ given by Proposition 1.9.

When working with a compact $\operatorname{Z}$-bundle $\operatorname{B}$ over
$S$, we shall often want to ensure that the bundle is locally trivial, meaning
that for every $x\in\operatorname{B}$ there is an open set $U\subset S$
containing the projection $\pi(x)$, and a homeomorphism $\pi^{-1}(U)\to
U\times\operatorname{Z}$ of the form $x\mapsto(\pi(x),\varphi(x))$ where
$\varphi:\pi^{-1}(U)\to\operatorname{Z}$ is $\operatorname{Z}$-equivariant
(that is $\varphi(x+z)=\varphi(x)+z$ for every $x\in\pi^{-1}(U)$,
$z\in\operatorname{Z}$). A theorem of Gleason [14, Theorem 3.3] tells us that
this local triviality holds provided that $\operatorname{Z}$ is a Lie group
(see also [1, Theorem 1.1]). We record the special case of this result that we
shall use.

######  Proposition 5.2 (Consequence of Gleason’s slice theorem).

Let $\operatorname{Z}$ be a compact abelian Lie group, and let
$\operatorname{B}$ be a continuous $\operatorname{Z}$-bundle. Then
$\operatorname{B}$ is locally trivial.

Recalling that a compact abelian group is a Lie group if and only if it has
finite rank, we deduce the following result.

######  Lemma 5.3.

Let $\operatorname{X}$ be a $k$-step compact nilspace of finite rank with
structure groups $\operatorname{Z}_{1},\dots,\operatorname{Z}_{k}$ and factors
$\operatorname{X}_{0},\dots,\operatorname{X}_{k}$. Then $\operatorname{X}_{i}$
is a locally trivial $\operatorname{Z}_{i}$-bundle over
$\operatorname{X}_{i-1}$ for each $i\in[k]$.

Thus, topologically a $k$-step compact nilspace of finite rank is a finite
dimensional manifold.

######  Definition 5.4.

Recall that every compact abelian Lie group $\operatorname{Z}$ is isomorphic
to a direct product $F\times\mathbb{T}^{n}$ for some finite abelian group $F$
and $n\geq 0$. We can then define a natural metric $d_{2}$ on
$\operatorname{Z}$ as follows. For two elements
$x,y\in\mathbb{T}^{n}=\mathbb{R}^{n}/\mathbb{Z}^{n}$ we define $d_{2}(x,y)$ as
the minimum of the Euclidean distances between preimages of $x$ and $y$ under
the map $\mathbb{R}^{n}\to\mathbb{R}^{n}/\mathbb{Z}^{n}$. If
$\operatorname{Z}$ is not connected, then for points $x,y$ in different
connected components we declare that $d_{2}(x,y)=\infty$.

We now turn to the definition of averaging for a function on a nilspace taking
values in a compact abelian group $\operatorname{Z}$. Here we face the problem
that in general the average of a $\operatorname{Z}$-valued function is not
well-defined. This is clear already in the simple case of the circle group
$\operatorname{Z}=\mathbb{T}$, where there is no suitable notion of
multiplication by a real number. However, if we assume that the function takes
all its values in a short interval, then we can lift this $\mathbb{T}$-valued
function to a real-valued one, then take the usual average, and then project
the obtained value back to $\mathbb{T}$. We capture this idea more generally
as follows.

######  Definition 5.5.

Let $\operatorname{Z}\cong F\times\mathbb{T}^{n}$ be a compact abelian Lie
group. Let $f$ be a Borel measurable function from a probability space $X$ to
$\operatorname{Z}$, and suppose there exists
$z=(g,\theta)\in\operatorname{Z}$, ($\theta\in\mathbb{T}^{n}$) such that every
value of $f$ lies in the ball $B_{1/4}(z)$ in the metric $d_{2}$. Then,
letting $\pi$ denote the projection $\mathbb{R}^{n}\to\mathbb{T}^{n}$, for any
fixed lift $\theta^{\prime}\in\mathbb{R}^{n}$ there is a unique function
$f^{\prime}:X\to\mathbb{R}^{n}$ such that
$f(x)=(g,\pi\operatorname{\circ}f^{\prime}(x))$ and $f^{\prime}$ takes all its
values in $B_{z^{\prime}}(1/4)$ in the euclidean distance. We then define the
average value $\mathbb{E}f$ to be $(g,\pi(\mathbb{E}f^{\prime}))$.

Note that $\mathbb{E}(f)$ does not depend on the choice of the lift of $z$.
Let us say that a function $f:X\to\operatorname{Z}$ is $\delta$_-concentrated_
if there exists $z\in\operatorname{Z}$ such that $f(x)\in B_{\delta}(z)$ for
all $x\in X$.

######  Lemma 5.6.

Let $\operatorname{Z}$ be a compact abelian Lie group, and let
$m\in\mathbb{N}$. Then for any $(1/4m)$-concentrated measurable functions
$f_{1},\dots,f_{m}$ from a probability space $X$ to $\operatorname{Z}$, the
average of $f_{1}+\cdots+f_{m}$ is well defined and satisfies
$\mathbb{E}(f_{1}+\cdots+f_{m})=\mathbb{E}f_{1}+\cdots+\mathbb{E}f_{m}$.

###### Proof.

The assumption implies that $f_{1}+\cdots+f_{m}$ is $1/4$-concentrated, so its
average is well-defined. The additivity then follows in a straightforward way
from the additivity of the usual average for real-valued functions. ∎

As a first application of this notion of averaging, we obtain the following
rigidity result for cocycles. Stronger versions of this result will be very
useful in later sections. Recall from [8, Definition 3.3.18] that a function
$\operatorname{C}^{k}(\operatorname{X})\to\operatorname{Z}$ is called a
coboundary if it is of the form
$\operatorname{c}\mapsto\sigma_{k}(f\operatorname{\circ}\operatorname{c})$ for
some function $f:\operatorname{X}\to\operatorname{Z}$.

######  Lemma 5.7.

Let $\operatorname{X}$ be a compact $\ell$-step nilspace and let
$\operatorname{Z}$ be a compact abelian group of finite rank. There exists
$\epsilon>0$ such that, for every Borel measurable cocycle
$\rho:\operatorname{C}^{k}(\operatorname{X})\to\operatorname{Z}$, if
$d_{2}(\rho(\operatorname{c}),0)\leq\epsilon$ for every
$\operatorname{c}\in\operatorname{C}^{k}(\operatorname{X})$ then there exists
a Borel measurable function $g:\operatorname{X}\to\operatorname{Z}$ such that
$\rho$ is the coboundary
$\operatorname{c}\mapsto\sigma_{k}(g\operatorname{\circ}\operatorname{c})$.

###### Proof.

For any $x\in\operatorname{X}$, consider the space of cubes
$\operatorname{C}^{k}_{x}(\operatorname{X})$ with the Haar probability given
by Lemma 2.17. By assumption $\rho$ is $\epsilon$-concentrated on
$\operatorname{C}^{k}_{x}(\operatorname{X})$, so we may define

$g:\operatorname{X}\to\operatorname{Z},\;x\mapsto\mathbb{E}_{\operatorname{C}^{k}_{x}(\operatorname{X})}\,\rho(\operatorname{c}).$

Fix any $\operatorname{c}\in\operatorname{C}^{k}(\operatorname{X})$ and let
$\Omega=\hom_{\operatorname{c}\operatorname{\circ}\omega_{k}^{-1}}(T_{k},\operatorname{X})$.
For any $t\in\Omega$, by [8, Lemma 3.3.31] we have
$\rho(\operatorname{c})=\sum_{v\in\\{0,1\\}^{k}}(-1)^{|v|}\rho(t\operatorname{\circ}\Psi_{v})$.
By Corollary 2.22, we have that for each $v$ the map $t\mapsto
t\operatorname{\circ}\Psi_{v}$,
$\Omega\to\operatorname{C}^{k}_{\operatorname{c}(v)}(\operatorname{X})$
preserves the Haar measures (where the Haar measure on $\Omega$ is given by
Corollary 2.20). Hence, by averaging over $t$ in the last equation, we obtain
$\rho(\operatorname{c})=\sum_{v\in\\{0,1\\}^{k}}(-1)^{|v|}g(\operatorname{c}(v))=\sigma_{k}(g\operatorname{\circ}\operatorname{c})$.
∎

###  6 Counting isomorphism classes of compact finite-rank nilspaces

In this section we use the parametrization of compact extensions by cocycles,
given in Corollary 4.8, to prove the following result.

######  Theorem 6.1.

There are countably many isomorphism classes of compact nilspaces of finite
rank.

To prove this we shall use the following lemma, that strengthens Lemma 5.7 by
allowing its premise to fail on a null set.

######  Lemma 6.2.

Let $\operatorname{X}$ be a compact $\ell$-step nilspace and
$\operatorname{Z}$ be a compact abelian group of finite rank. Then there
exists $\epsilon>0$ such that every Borel measurable cocycle
$\rho:\operatorname{C}^{k}(\operatorname{X})\to\operatorname{Z}$ satisfying
$d_{2}(\rho(\operatorname{c}),0)\leq\epsilon$ for almost every
$\operatorname{c}\in\operatorname{C}^{k}(\operatorname{X})$ is a coboundary.

This relies on the following fact.

######  Lemma 6.3.

Let $\operatorname{X}$ be a compact $\ell$-step nilspace and let
$\operatorname{Z}$ be a compact abelian group of finite rank. Let
$\rho:\operatorname{C}^{k}(\operatorname{X})\to\operatorname{Z}$ be a Borel
measurable cocycle such that $\rho=0$ for almost every element in
$\operatorname{C}^{k}(\operatorname{X})$. Then $\rho$ is a coboundary.

###### Proof.

Let $S=\\{x\in\operatorname{X}:\rho_{x}=0\textrm{ almost surely on
}\operatorname{C}_{x}^{k}(\operatorname{X})\\}$. It follows from the
properties of the CSM on
$\operatorname{C}^{k}(\operatorname{X})\to\operatorname{X}$,
$\operatorname{c}\mapsto\operatorname{c}(0^{k})$ (given by Lemma 2.17) that
$S$ has probability $1$. For every $x\in S$ the set
$\rho_{x}+\operatorname{Z}\,\subset\operatorname{\mathcal{L}}_{k}(\operatorname{X},\operatorname{Z})$
consists of functions that are constant almost everywhere. Since by
Proposition 2.11 every open set in $\operatorname{X}$ has positive measure, we
have that $S$ is dense in $\operatorname{X}$. We claim that for every
$x\in\operatorname{X}$ the function $\rho_{x}$ equals a constant almost
everywhere. Indeed, by density of $S$ there exists a sequence of points
$x_{n}\in S$ converging to $x$. For each $n$ choose an element
$\rho_{x_{n}}+a_{n}\in M(\rho)$ equal to a constant almost surely. By
Proposition 4.2 the extension $M$ is compact and so there is a subsequence of
such functions $\rho_{x_{m}}+a_{m}$ converging in $M$. By Lemma 3.8, the limit
is constant almost everywhere, and (as a point of $M$) is $\rho_{x}+a$ for
some $a\in\operatorname{Z}$, which proves our claim. From this, we deduce that
the function $g:\operatorname{X}\to\operatorname{Z}$,
$x\mapsto\mathbb{E}_{\operatorname{c}\in\operatorname{C}^{k}_{x}(\operatorname{X})}\rho(\operatorname{c})$
is well-defined and that for each $x\in\operatorname{X}$ we have
$\rho(\operatorname{c})=g(x)$ for almost every
$\operatorname{c}\in\operatorname{C}^{k}_{x}(\operatorname{X})$. We now claim
that for every $x\in\operatorname{X}$, we have
$\rho(\operatorname{c})=\sigma_{k}(g\operatorname{\circ}\operatorname{c})$ for
almost every $\operatorname{c}\in\operatorname{C}^{k}(\operatorname{X})$. This
follows from an argument similar to the second paragraph in the proof of Lemma
5.7. Thus, denoting by $f$ the coboundary
$\operatorname{c}\mapsto\sigma_{k}(g\operatorname{\circ}\operatorname{c})$,
the cocycle $\rho^{\prime}=\rho-f$ has the property that for every
$x\in\operatorname{X}$ we have $\rho^{\prime}_{x}=0$ almost surely on
$\operatorname{C}_{x}^{k}(\operatorname{X})$. This implies that
$\rho^{\prime}=0$ everywhere. Indeed, for an arbitrary fixed
$\operatorname{c}\in\operatorname{C}^{k}(\operatorname{X})$, and any
$t\in\hom_{\operatorname{c}\operatorname{\circ}\omega_{k}^{-1}}(T_{k},\operatorname{X})$,
by [8, Lemma 3.3.31] we have
$\rho^{\prime}(\operatorname{c})=\beta(t,\rho^{\prime})$, and then, averaging
both sides of this equation over $t$, the right side vanishes since
$\rho_{x}^{\prime}$ is 0 almost everywhere (using again that each map
$t\mapsto t\circ\Psi_{v}$ is probability-preserving, by Corollary 2.22). ∎

###### Proof of Lemma 6.2.

We argue as in the proof of Lemma 5.7. Let $S$ be the set of elements
$x\in\operatorname{X}$ for which $\rho_{x}$ is almost surely within $\epsilon$
of $0$ in $d_{2}$. By the assumption, we have that $S$ has probability $1$. We
define $g:\operatorname{X}\to\operatorname{Z}$ for $x\in S$ by
$g(x)=\mathbb{E}_{\operatorname{C}^{k}_{x}(\operatorname{X})}\,\rho(\operatorname{c})$,
and for $x\in\operatorname{X}\setminus S$ by setting $g(x)=0$. Letting
$\rho_{2}(\operatorname{c})=\sigma_{k}(g\operatorname{\circ}\operatorname{c})$,
the same averaging argument shows that $\rho_{2}=\rho$ almost surely. By Lemma
6.3 the difference $\rho-\rho_{2}$ is a coboundary, whence $\rho$ is a
coboundary. ∎

We can now prove the main result of this section.

###### Proof of Theorem 6.1.

We claim that for every $k\in\mathbb{N}$, for every compact $(k-1)$-step
nilspace $\operatorname{X}$ of finite rank and every compact abelian Lie group
$\operatorname{Z}$, there are at most countably many non-isomorphic degree-$k$
extensions of $\operatorname{X}$ by $\operatorname{Z}$. This implies the
theorem by induction on $k$.
To prove the claim, we first associate with each $\operatorname{Z}$-extension
of $\operatorname{X}$ a measurable cocycle $\rho_{\operatorname{s}}$ generated
by a piecewise-continuous cross section $\operatorname{s}$ for the extension.
We construct $\operatorname{s}$ as follows.

Since $\operatorname{X}$ is a finite-dimensional compact manifold, there exist
disjoint open sets $U_{1},U_{2},\dots,U_{r}$, each homeomorphic to the open
unit Euclidean ball in $\mathbb{R}^{n}$ for some $n\geq 0$, such that
$U=\bigcup_{i\in[r]}U_{i}$ has measure $1$ in $\operatorname{X}$. Let $M$
denote the given degree-$k$ extension of $\operatorname{X}$ by
$\operatorname{Z}$, with projection $\pi:M\to\operatorname{X}$. Every
$\operatorname{Z}$-bundle over a contractible space is trivial [27, Ch. 4,
Corollary 10.3]. Therefore there exists a continuous cross section
$\operatorname{s}_{i}$ locally on each $U_{i}$, and combining these we obtain
a piecewise continuous (hence Borel-measurable) cross section
$\operatorname{s}:\operatorname{X}\to M$, with
$\operatorname{s}|_{U_{i}}=\operatorname{s}_{i}$. Let
$T\subseteq\operatorname{C}^{k+1}(\operatorname{X})$ denote the set of cubes
whose vertices are all in $U$. We can partition the cubes $\operatorname{c}\in
T$ according to which set $U_{i}$ contains each value $\operatorname{c}(v)$,
that is $T=\bigsqcup_{i\in[r]^{\\{0,1\\}^{k+1}}}T_{i}$, where
$T_{i}\,=\,T\;\cap\prod_{v\in\\{0,1\\}^{k+1}}U_{i_{v}}$. The cocycle
$\rho_{\operatorname{s}}:\operatorname{C}^{k+1}(\operatorname{X})\to\operatorname{Z}$
is defined by
$\rho_{\operatorname{s}}(\operatorname{c})=\sigma_{k+1}(\operatorname{s}\operatorname{\circ}\operatorname{c}-\operatorname{c}^{\prime})$
for any $\operatorname{c}^{\prime}\in\operatorname{C}^{k+1}(M)$ with
$\pi\operatorname{\circ}\operatorname{c}^{\prime}=\operatorname{c}$ (recall
[8, Lemma 3.3.21]). Note that $\rho_{\operatorname{s}}$ is continuous on each
part $T_{i}$.
Now let $\epsilon>0$ be as given by Lemma 6.2. Then for any other degree-$k$
extension $M^{\prime}$, we can generate a cocycle
$\rho_{\operatorname{s}^{\prime}}$ as above, and if
$d_{2}\big{(}\rho_{\operatorname{s}}(\operatorname{c}),\rho_{\operatorname{s}^{\prime}}(\operatorname{c})\big{)}<\epsilon$
for almost every $\operatorname{c}$ then by the lemma
$\rho_{\operatorname{s}^{\prime}}$ must equal $\rho_{\operatorname{s}}$ plus a
coboundary, which implies, by Corollary 4.8, that $M^{\prime}$ is isomorphic
to $M$.
Let $d_{\infty}$ denote the uniform metric on the set of continuous functions
$\operatorname{C}^{k+1}(\operatorname{X})\to\operatorname{Z}$, defined by
$d_{\infty}(f_{1},f_{2})=\sup_{\operatorname{c}}d_{2}\big{(}f_{1}(\operatorname{c}),f_{2}(\operatorname{c})\big{)}$.
For each $i$, the space of continuous functions $T_{i}\to\operatorname{Z}$
with $d_{\infty}$ is separable (essentially by separability of the space
$C(Y,\operatorname{Z})$ for any compact subset $Y$ of a Euclidean space [28,
Theorem (4.19)]). Therefore there exists a countable $\frac{\epsilon}{2}$-net
$(f_{i,j})_{j\in\mathbb{N}}$ of such continuous functions on each $T_{i}$.
Then, by the previous paragraph, for each choice of functions
$\\{f_{i,j_{i}}:i\in[r]^{\\{0,1\\}^{k+1}}\\}$ from these nets, there can only
be at most one isomorphism class of extensions having an associated cocycle
$\rho_{\operatorname{s}}$ satisfying
$d_{\infty}(\rho_{\operatorname{s}}|_{T_{i}},f_{i,j_{i}})<\epsilon/2$ for each
$i$. ∎

###  7 Compact nilspaces as inverse limits of finite-rank nilspaces

In this section we treat one of the central results from [9], namely that
every compact nilspace can be expressed as an inverse limit of compact
nilspaces of finite rank. Before we give the formal statement, let us detail
the inverse limit construction in this category.

######  Definition 7.1.

An _inverse system_ (or projective system) of compact nilspaces over
$\mathbb{N}$ is a family of continuous nilspace morphisms
$\\{\varphi_{ij}:\operatorname{X}_{j}\to\operatorname{X}_{i}~{}|~{}i,j\in\mathbb{N},i\leq
j\\}$, where $\operatorname{X}_{j}$, $j\in\mathbb{N}$ are compact nilspaces,
such that $\varphi_{jj}$ is the identity morphism for all $j\in\mathbb{N}$,
and for all $i,j,k\in\mathbb{N}$ with $i\leq j\leq k$ we have
$\varphi_{ij}\operatorname{\circ}\varphi_{jk}=\varphi_{ik}$. The inverse
system is said to be _strict_ if every morphism $\varphi_{ij}$ is fibre-
surjective.

######  Lemma 7.2.

Let $S=(\varphi_{ij}:\operatorname{X}_{j}\to\operatorname{X}_{i})_{i\leq j}$
be a strict inverse system of compact nilspaces. Let

$\operatorname{X}=\Big{\\{}(x_{i})\in\prod_{i\in\mathbb{N}}\operatorname{X}_{i}~{}|~{}\varphi_{ij}(x_{j})=x_{i}\;\;\forall\,i,j\in\mathbb{N},\;i\leq
j\Big{\\}},$

and for each $n\geq 0$ let
$\operatorname{C}^{n}(\operatorname{X})=\big{\\{}(\operatorname{c}_{i})\in\prod_{i\in\mathbb{N}}\operatorname{C}^{n}(\operatorname{X}_{i})~{}|~{}\varphi_{ij}\operatorname{\circ}\operatorname{c}_{j}=\operatorname{c}_{i}\;\;\forall\,i,j\in\mathbb{N},\;i\leq
j\big{\\}}$. The space $\operatorname{X}$ together with the cube sets
$\operatorname{C}^{n}(\operatorname{X})$ is a compact nilspace, called the
_inverse limit_ of $S$, and denoted $\varprojlim_{i}\operatorname{X}_{i}$. We
have that $\operatorname{X}$ is $k$-step if and only if every
$\operatorname{X}_{i}$ is $k$-step.

We call the maps $\varphi_{ij}$ the _transition morphisms_. The _projections_
on $\operatorname{X}$, denoted by $\varphi_{j}$, are the coordinate
projections on $\prod_{i\in\mathbb{N}}\operatorname{X}_{i}$ restricted to
$\operatorname{X}$. If the inverse system is strict then the projections are
also fibre-surjective morphisms. The $\ell$-th structure group of
$\varprojlim_{i}\operatorname{X}_{i}$ is the inverse limit of the system
$(\alpha_{\ell,ij}:\operatorname{Z}_{\ell,j}\to\operatorname{Z}_{\ell,i})_{i\leq
j}$, where $\operatorname{Z}_{\ell,j}$ is the $\ell$-th structure group of
$\operatorname{X}_{j}$ and $\alpha_{\ell,ij}$ is the $\ell$-th structure
morphism of $\varphi_{ij}$.

###### Proof.

A straightforward argument with convergent sequences shows that
$\operatorname{X}$ is a closed subspace of the compact space
$\prod_{i\in\mathbb{N}}\operatorname{X}_{i}$, and similarly for each set
$\operatorname{C}^{n}(\operatorname{X})$. The ergodicity and composition
axioms are clear. Let us prove that $\operatorname{X}$ satisfies the
completion axiom. Let $\operatorname{c}^{\prime}$ be an $n$-corner on
$\operatorname{X}$. Then for each $i\in\mathbb{N}$ the projection
$\operatorname{c}_{i}^{\prime}=\varphi_{i}\operatorname{\circ}\operatorname{c}^{\prime}$
is an $n$-corner on $\operatorname{X}_{i}$. Now
$\operatorname{c}_{1}^{\prime}$ has a completion $\operatorname{c}_{1}$ and by
fibre-surjectivity there exists
$\tilde{\operatorname{c}}_{1}\in\operatorname{C}^{n}(\operatorname{X}_{2})$
such that
$\varphi_{12}\operatorname{\circ}\tilde{\operatorname{c}}_{1}=\operatorname{c}_{1}$
(recall [8, Lemma 3.3.9]). The restriction of $\tilde{\operatorname{c}}_{1}$
to $P=\\{0,1\\}^{n}\setminus\\{1^{n}\\}$ is in the same fibre of the map
$\operatorname{c}^{\prime}\mapsto\varphi_{12}\operatorname{\circ}\operatorname{c}^{\prime}$
as $\operatorname{c}_{2}^{\prime}$, so by [8, Lemma 3.3.12 (ii)] these two
corners differ by an $n$-corner on
$\operatorname{\mathcal{D}}_{k}(\ker(\alpha_{k}))$, where $\alpha_{k}$ is the
$k$-th structure morphism of $\varphi_{12}$. Now by modifying
$\tilde{\operatorname{c}}_{1}$, we can obtain a cube $\operatorname{c}_{2}$
that is still in this fibre (so that
$\varphi_{12}\operatorname{\circ}\operatorname{c}_{2}=\operatorname{c}_{1}$)
and such that $\operatorname{c}_{2}|_{P}=\operatorname{c}_{2}^{\prime}|_{P}$.
Indeed, we can obtain $\operatorname{c}_{2}$ by adding first an appropriate
element of $\ker(\alpha_{k})$ to the values of $\tilde{\operatorname{c}}_{1}$
at the vertices of the 1-face $\\{0^{n},(1,0,\dots,0)\\}$ so that it agrees
with $\operatorname{c}_{2}^{\prime}$ at $0^{n}$, then repeat this for each
subsequent 1-face along a Hamiltonian path in the graph of 1-faces on
$\\{0,1\\}^{n}$ (similar arguments were used several times in [8], for
instance in the proof of [8, Lemma 3.2.25]). We have thus obtained a cube
$\operatorname{c}_{2}$ completing $\operatorname{c}_{2}^{\prime}$ and such
that
$\varphi_{12}\operatorname{\circ}\operatorname{c}_{2}=\operatorname{c}_{1}$.
Now we repeat this operation to obtain $\operatorname{c}_{3}$ completing
$\operatorname{c}_{3}^{\prime}$ such that
$\varphi_{23}\operatorname{\circ}\operatorname{c}_{3}=\operatorname{c}_{2}$,
and so on. This yields a sequence of cubes
$\operatorname{c}_{i}\in\operatorname{C}^{n}(\operatorname{X})$ such that for
each $i$ we have $\varphi_{j}\operatorname{\circ}\operatorname{c}_{i}$ is a
completion of $\operatorname{c}_{j}^{\prime}$ for all $j\leq i$. The limit of
a convergent subsequence of $(\operatorname{c}_{i})$ is a completion of
$\operatorname{c}^{\prime}$. To see the last claim in the lemma, recall from
[8, Definition 3.3.7] that a fibre-surjective morphism preserves the property
of being $k$-step. ∎

We can now state the main result of this section.

######  Theorem 7.3.

Every $k$-step compact nilspace is an inverse limit of compact nilspaces of
finite rank.

The basic case of this theorem, concerning 1-step nilspaces, is given by the
standard result that every compact abelian group is an inverse limit of
compact abelian Lie groups (see [24, Corollary 2.43]). This standard result
also yields the following example of an inverse limit of nilspaces, which will
be used in the proof of Theorem 7.3.

######  Proposition 7.4.

Let $\operatorname{X}$ be a $k$-step compact nilspace. Then $\operatorname{X}$
is an inverse limit of $k$-step nilspaces $\operatorname{X}_{i}$, each with
$k$-th structure group a compact abelian Lie group, and with
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{X}_{i})$ isomorphic to
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})$.

###### Proof.

By the standard result for compact abelian groups recalled above, for the
$k$-th structure group $\operatorname{Z}_{k}$ of $\operatorname{X}$ we have
for each $i\in\mathbb{N}$ a compact abelian Lie group $\operatorname{Z}_{k,i}$
and a surjective continuous homomorphism
$\alpha_{i}:\operatorname{Z}_{k}\to\operatorname{Z}_{k,i}$ such that
$\operatorname{Z}_{k}=\varprojlim\operatorname{Z}_{k,i}$. (For $i\leq j$ the
transition morphism $\alpha_{i,j}$ is $x\mapsto x+\ker\alpha_{i}$ for
$x\in\operatorname{Z}_{k,j}\cong\operatorname{Z}_{k}/\ker\alpha_{j}$.) Define
for each $i$ the $k$-step compact nilspace $\operatorname{X}_{i}$ as the image
of $\operatorname{X}$ under the map $\varphi_{i}$ that sends
$x\in\operatorname{X}$ to the orbit $x+\ker\alpha_{i}$. A straightforward
calculation shows that $\operatorname{X}_{i}$, with the quotient cube-
structure of $\operatorname{X}$ by $\ker\alpha_{i}$ and the quotient topology,
is a $k$-step compact nilspace with $k$-th structure group
$\operatorname{Z}_{k,i}$. The projections
$\operatorname{X}\to\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})$ and
$\operatorname{X}_{i}\to\operatorname{\mathcal{F}}_{k-1}(\operatorname{X}_{i})$
are both given by the orbit map for the $\operatorname{Z}_{k}$-action, and it
follows that
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\cong\operatorname{\mathcal{F}}_{k-1}(\operatorname{X}_{i})$
as compact nilspaces. The transition morphisms
$\varphi_{ij}:\operatorname{X}_{j}\to\operatorname{X}_{i}$, defined by
$x+\ker\alpha_{j}\mapsto x+\ker\alpha_{i}$, are all clearly fibre-surjective.
∎

Recall from [8, Lemma 3.3.21] that given a degree-$k$ extension
$\operatorname{Y}$ of $\operatorname{X}$ by $\operatorname{Z}$, and given a
cross section $\operatorname{s}:\operatorname{X}\to\operatorname{Y}$, letting
$f:\operatorname{Y}\to\operatorname{Z}$,
$y\mapsto\operatorname{s}\operatorname{\circ}\pi(y)-y$, the cocycle generated
by $\operatorname{s}$ is the degree-$k$ cocycle
$\rho_{\operatorname{s}}:\operatorname{C}^{k+1}(\operatorname{X})\to\operatorname{Z}$
defined by
$\rho_{\operatorname{s}}(\operatorname{c})=\sigma_{k+1}(f\operatorname{\circ}\operatorname{c}^{\prime})$,
for any $\operatorname{c}^{\prime}\in\operatorname{C}^{k+1}(\operatorname{Y})$
such that $\pi\operatorname{\circ}\operatorname{c}^{\prime}=\operatorname{c}$.

For the proof of Theorem 7.3, it will be useful to be able to tell in a simple
way whether a given cocycle on a nilspace $\operatorname{X}$ induces a well-
defined cocycle on another nilspace $\operatorname{X}^{\prime}$ via some given
fibre-surjective morphism $\operatorname{X}\to\operatorname{X}^{\prime}$. The
following definition provides such a criterion.

######  Definition 7.5.

Let $\operatorname{X}$ be a $k$-step compact nilspace, and for some compact
nilspace $\operatorname{X}^{\prime}$ let
$\psi:\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\to\operatorname{X}^{\prime}$
be a continuous fibre-surjective morphism. We say that a measurable cross
section
$\operatorname{s}:\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\to\operatorname{X}$
is _consistent with the factor_ $\operatorname{X}^{\prime}$ if the cocycle
$\rho_{\operatorname{s}}:\operatorname{C}^{k+1}(\operatorname{\mathcal{F}}_{k-1}(\operatorname{X}))\to\operatorname{Z}_{k}$
satisfies
$\rho_{\operatorname{s}}(\operatorname{c}_{1})=\rho_{\operatorname{s}}(\operatorname{c}_{2})$
for every $\operatorname{c}_{1},\operatorname{c}_{2}$ such that
$\psi\operatorname{\circ}\operatorname{c}_{1}=\psi\operatorname{\circ}\operatorname{c}_{2}$.

Thus if $\operatorname{s}$ is consistent with $\operatorname{X}^{\prime}$ then
$\rho_{\operatorname{s}}$ induces a cocycle
$\rho^{\prime}:\operatorname{C}^{k+1}(\operatorname{X}^{\prime})\to\operatorname{Z}_{k}$,
well-defined by
$\rho^{\prime}(\operatorname{c}^{\prime})=\rho_{\operatorname{s}}(\operatorname{c})$
for any $\operatorname{c}$ such that
$\psi\operatorname{\circ}\operatorname{c}=\operatorname{c}^{\prime}$. Note
that we shall often refer to the image of a fibre-surjective morphism on
$\operatorname{X}$ as a _fibre-surjective factor_ of $\operatorname{X}$.

######  Lemma 7.6.

Let
$\psi:\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\to\operatorname{X}^{\prime}$
be a fibre-surjective morphism and let
$\operatorname{s}:\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\to\operatorname{X}$
be a cross section consistent with $\operatorname{X}^{\prime}$. Let $\sim$ be
the equivalence relation on $\operatorname{X}$ defined by

$x\sim
y\;\;\Leftrightarrow\;\;\big{(}\;\psi\operatorname{\circ}\pi_{k-1}(x)=\psi\operatorname{\circ}\pi_{k-1}(y)\textrm{
and
}x-\operatorname{s}\operatorname{\circ}\pi_{k-1}(x)=y-\operatorname{s}\operatorname{\circ}\pi_{k-1}(y)\;\big{)}.$

Then the quotient nilspace $\operatorname{X}/_{\sim}$ is a fibre-surjective
factor of $\operatorname{X}$ which is an extension of
$\operatorname{X}^{\prime}$ by $\operatorname{Z}_{k}$.

###### Proof.

Let
$\rho^{\prime}:\operatorname{C}^{k+1}(\operatorname{X}^{\prime})\to\operatorname{Z}_{k}$
be the cocycle induced by $\rho_{\operatorname{s}}$. Let $M(\rho^{\prime})$ be
the compact nilspace extending $\operatorname{X}^{\prime}$ by
$\operatorname{Z}_{k}$ given by Proposition 4.2. Let $f:\operatorname{X}\to
M(\rho^{\prime})$ be defined by
$f(x)=\rho^{\prime}_{\psi(\pi_{k-1}(x))}+x-\operatorname{s}\operatorname{\circ}\pi_{k-1}(x)$.
Using Definition 4.3 we check that $f$ is a morphism (a similar calculation
appears in the proof of [8, Lemma 3.3.28]). It is also checked easily that $f$
is fibre-surjective. Moreover, clearly $f(x_{1})=f(x_{2})$ if and only if
$x_{1}\sim x_{2}$. It follows that $f$ factors through $\sim$ giving a
bijective measurable morphism
$f^{\prime}:\operatorname{X}/_{\sim}\to\operatorname{Y}$. Then $f^{\prime}$ is
a continuous isomorphism of compact nilspaces, by Theorem 4.6. ∎

The following lemma will be used in the proof of Theorem 7.3 and also in
Section 9. Recall the notation $d_{2}$ for the metric from Definition 5.4.

######  Lemma 7.7.

Let $\operatorname{X}$ be a $k$-step compact nilspace such that the $k$-th
structure group $\operatorname{Z}_{k}$ has finite rank, and let $d$ be a
compatible metric on $\operatorname{X}$. Then for any $\epsilon>0$ there
exists $\delta>0$ such that the following holds. Let
$x_{0},x_{1},y_{0},y_{1}\in\operatorname{X}$ be such that
$\pi_{k-1}(x_{i})=\pi_{k-1}(y_{i})$ for $i=0,1$ and
$d(x_{0},x_{1}),d(y_{0},y_{1})$ are both at most $\delta$. Then in
$\operatorname{Z}_{k}$ we have $d_{2}(y_{0}-x_{0},y_{1}-x_{1})\leq\epsilon$.

###### Proof.

Consider the local translation $\phi=\phi_{x_{0},x_{1}}$ (recall [8,
Definition 3.2.26]). By definition of $\phi$ we have
$y_{0}-x_{0}=\phi(y_{0})-x_{1}$ in $\operatorname{Z}_{k}$ (using implicitly
the isomorphism from [8, Lemma 3.2.24]), so it suffices to show that
$d_{2}(\phi(y_{0})-x_{1},y_{1}-x_{1})\leq\epsilon$ for $\delta$ sufficiently
small.

Since $d(x_{0},x_{1})$ is unchanged by adding $y_{0}-x_{0}=\phi(y_{0})-x_{1}$
to $x_{0}$ and $x_{1}$, we have $d(y_{0},\phi(y_{0}))\leq\delta$. This
together with $d(y_{0},y_{1})\leq\delta$ implies that
$d(\phi(y_{0}),y_{1})\leq 2\delta$. Thus, the lemma will follow if we prove
the following statement: for every $\epsilon>0$ there exists $\delta>0$ such
that whenever $x_{1},x_{2},x_{3}\in\operatorname{X}$ are in the same fibre of
$\pi_{k-1}$ and $d(x_{2},x_{3})\leq\delta$, we have
$d_{2}(x_{2}-x_{1},x_{3}-x_{1})\leq\epsilon$. This can be shown by a
straightforward argument using the local triviality of the
$\operatorname{Z}_{k}$-bundle $\operatorname{X}$ and the compactness of
$\operatorname{X}_{k-1}$. ∎

####  1 Proof of the inverse limit theorem

To prove Theorem 7.3, we argue by induction on $k$, starting with the trivial
case $k=0$. For $k>0$ we suppose that $\operatorname{X}$ is a $k$-step compact
nilspace such that the nilspace
$\operatorname{Y}=\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})$ is the
inverse limit of a strict inverse system
$(\tau_{ij}:\operatorname{Y}_{j}\to\operatorname{Y}_{i})_{i,j\in\mathbb{N},i\leq
j}$. We denote by $\pi$ the projection $\operatorname{X}\to\operatorname{Y}$,
and for each $i$ we denote by $\tau_{i}$ the projection
$\operatorname{Y}\to\operatorname{Y}_{i}$ and let
$\mathcal{Q}_{i}=\\{\tau_{i}^{-1}(Q):Q\subset\operatorname{Y}_{i},\;Q\textrm{
open}\\}$. Since by assumption the topology on $\operatorname{Y}$ is the
initial topology generated by the maps $\tau_{i}$, we have that the finite
intersections of sets in $\bigcup_{i\in\mathbb{N}}\mathcal{Q}_{i}$ form a base
for this topology.

##### The inductive step: construction of the sequence $S$

We now apply Proposition 7.4 to $\operatorname{X}$. Let
$B_{0}=\operatorname{Z}_{k}$ be the $k$-th structure group of
$\operatorname{X}$, and let $B_{i}=\ker\alpha_{i}\leq\operatorname{Z}_{k}$ for
each $i\in\mathbb{N}$ (for the homomorphisms $\alpha_{i}$ from the proof of
the proposition). Then $B_{0}\geq B_{1}\geq\cdots$, with
$\bigcap_{i\in\mathbb{N}}B_{i}=\\{0\\}$, and
$\operatorname{X}=\varprojlim_{i}\operatorname{X}/_{B_{i}}$. Let $q_{i-1,i}$
denote the transition morphism
$\operatorname{X}/_{B_{i}}\to\operatorname{X}/_{B_{i-1}}$ and $q_{i}$ the
projection $\operatorname{X}\to\operatorname{X}/_{B_{i}}$. Note that
$\operatorname{X}/_{B_{i}}$ has $k$-th structure group
$\operatorname{Z}_{k}/B_{i}$, of finite rank.

The main goal of the inductive step is to construct, starting with the 1-point
nilspace $\operatorname{X}_{0}$, a sequence
$S=\\{(\operatorname{X}_{i},\psi_{i},\psi_{i}^{\prime},h_{i}):i\in\mathbb{N}\\}$,
where for each $i$ we have a compact nilspace $\operatorname{X}_{i}$ of finite
rank, and fibre-surjective morphisms
$\psi_{i}:\operatorname{X}/_{B_{i}}\to\operatorname{X}_{i}$ and
$\psi_{i}^{\prime}:\operatorname{X}_{i}\to\operatorname{X}_{i-1}$, with the
following properties:

  1. (i)

For every $i$, the restriction of $\psi_{i}$ to each class of $\sim_{k-1}$ in
$\operatorname{X}/_{B_{i}}$ is injective. In other words, the $k$-th structure
group of $\operatorname{X}_{i}$ is the same as that of
$\operatorname{X}/_{B_{i}}$, namely $\operatorname{Z}_{k}/B_{i}$.

  2. (ii)

For every $i$, we have
$\psi^{\prime}_{i}\circ\psi_{i}=\psi_{i-1}\operatorname{\circ}q_{i-1,i}$.

  3. (iii)

Letting $\pi_{i}$ denote the projection
$\operatorname{X}_{i}\mapsto\operatorname{\mathcal{F}}_{k-1}(\operatorname{X}_{i})$,
and $\kappa_{i}$ denote the projection
$\operatorname{X}/_{B_{i}}\to\operatorname{Y}$, we have
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{X}_{i})\cong\operatorname{Y}_{h_{i}}$
and
$\pi_{i}\operatorname{\circ}\psi_{i}=\tau_{h_{i}}\operatorname{\circ}\kappa_{i}$.

Properties (i) and (iii) imply that any two distinct points in
$\operatorname{X}$ are separated by a map $\psi_{i}\operatorname{\circ}q_{i}$
for some $i$, so the initial topology on $\operatorname{X}$ generated by these
maps is Hausdorff. Since the original topology on $\operatorname{X}$ is
compact, it follows that this initial topology equals the original topology
(see [6, §9.4, Corollary 3]). The maps
$\varphi_{ij}=\psi^{\prime}_{i+1}\operatorname{\circ}\cdots\operatorname{\circ}\psi^{\prime}_{j}$
and $\varphi_{i}:=\psi_{i}\operatorname{\circ}q_{i}$ satisfy the relations
$\varphi_{ij}\operatorname{\circ}\varphi_{j}=\varphi_{i}$ thanks to property
(ii). Hence $\operatorname{X}$ is the inverse limit of the system
$(\varphi_{ij}:\operatorname{X}_{j}\to\operatorname{X}_{i})_{i\leq j}$.

We shall now construct the sequence $S$ inductively starting from
$\operatorname{X}_{0}$. Suppose that
$(\operatorname{X}_{i},\psi_{i},\psi^{\prime}_{i},h_{i})$ has been constructed
for $i\leq m$. Then, to begin with, we construct a Borel cocycle
$\operatorname{C}^{k+1}(\operatorname{Y})\to\operatorname{Z}_{k}/B_{m+1}$
generated by a cross section $\operatorname{s}$ that is almost consistent with
some appropriate factor of $\operatorname{Y}$.

Constructing a measurable cross section $\operatorname{s}$: since
$\operatorname{X}_{m}$ is a compact locally-trivial
$\operatorname{Z}_{k}/B_{m}$-bundle over $\operatorname{Y}_{h_{m}}$, there is
a finite cover of $\operatorname{Y}_{h_{m}}$ by closed subsets
$W_{1},\ldots,W_{r}$ such that every preimage
$\pi_{m}^{-1}(W_{i})\subset\operatorname{X}_{m}$ is a trivial
$\operatorname{Z}_{k}/B_{m}$-bundle over $W_{i}$. For each $i\in[r]$, let
$\theta_{i}:W_{i}\to\operatorname{X}_{m}$ be a continuous cross section (thus
$\pi_{m}\operatorname{\circ}\theta_{i}$ is the identity map on $W_{i}$).
For each $a\in[r]$ let $W^{\prime}_{a}$ denote the preimage of the set
$\theta_{i}(W_{a})$ under
$\psi_{m}\operatorname{\circ}q_{m,m+1}:\operatorname{X}/_{B_{m+1}}\to\operatorname{X}_{m}$.
Note that $W^{\prime}_{a}$ is a $\operatorname{Z}_{k}/B_{m+1}$-bundle over
$\tau_{h_{m}}^{-1}(W_{a})\subset\operatorname{Y}$, so it is locally trivial by
Proposition 5.2. Let $d$ be a metric on $\operatorname{X}/_{B_{m+1}}$
generating its topology.

Now fix an arbitrary $\epsilon>0$. We claim that for every
$p\in\tau_{h_{m}}^{-1}(W_{a})$ there exists an open set
$U_{p}\subset\tau_{h_{m}}^{-1}(W_{a})$ containing $p$ with the following
properties:

  1. (iv)

There exists a continuous cross section
$\operatorname{s}_{p}:U_{p}\to\operatorname{X}/_{B_{m+1}}$.

  2. (v)

The diameter of $\operatorname{s}_{p}(U_{p})$ in the metric $d$ is at most
$\epsilon$.

  3. (vi)

For some $t(p)\in\mathbb{N}$, the set $U_{p}$ is in the collection
$\mathcal{Q}_{t(p)}$ defined above.

Property (iv) is ensured by the local triviality of the bundle, and it can be
satisfied together with (v) by letting $U_{p}$ be a ball of sufficiently small
radius, say. Property (vi) can also be satisfied since
$\bigcup_{i}\operatorname{\mathcal{Q}}_{i}$ generates the topology on
$\operatorname{Y}$ and for every $i\leq j$ and open
$Q\subset\operatorname{Y}_{i}$ we have
$\tau_{i}^{-1}Q=\tau_{j}^{-1}(\tau_{ij}^{-1}Q)\in\operatorname{\mathcal{Q}}_{j}$.
Since $\operatorname{Y}$ is compact there exists a finite cover by such sets
$U_{p}$, thus for some points $p_{1},p_{2},\dots,p_{n}$ we have
$\bigcup_{i=1}^{n}U_{p_{i}}\,\supset\,\tau_{h_{m}}^{-1}(W_{a})$. Let
$t_{a}=\max\\{t(p_{i}):i\in[n]\\}$, so that for every $i\in[n]$ we have
$U_{p_{i}}\subset\mathcal{Q}_{t_{a}}$. Then, by dividing
$\tau_{h_{m}}^{-1}(W_{a})$ into the atoms of the Boolean algebra generated by
$U_{p_{1}},\dots,U_{p_{n}}$, and then using one of the cross sections
$\operatorname{s}_{p}$ for each atom, we can construct a Borel measurable
cross section
$\operatorname{s}_{a}:\tau_{h_{m}}^{-1}(W_{a})\to\operatorname{X}/_{B_{m+1}}$
with the following properties:

  1. (vii)

The cross section $\operatorname{s}_{a}$ is continuous on
$\tau_{t_{a}}^{-1}(v)$ for every $v\in\operatorname{Y}_{t_{a}}$.

  2. (viii)

The diameter of $\operatorname{s}_{a}(\tau_{t_{a}}^{-1}(v))$ in $d$ is at most
$\epsilon$ for every $v\in\operatorname{Y}_{t_{a}}$.

Note that we obtain (viii) from (v) because each $\tau_{t_{a}}^{-1}(v)$ is
entirely contained in an atom of the Boolean algebra, which contains
$\tau_{t_{a}}^{-1}(Q)$ for some open $Q\supset v$. Let
$t=\max\\{t_{a}:a\in[r]\\}\cup\\{h_{m}+1\\}$. Using these partial cross
sections, we now claim that we can construct a global Borel cross section
$\operatorname{s}:\operatorname{Y}\to\operatorname{X}/_{B_{m+1}}$ with the
following properties:

  1. (ix)

The cross section $\operatorname{s}$ is continuous on every preimage
$\tau_{t}^{-1}(v)$ where $v\in\operatorname{Y}_{t}$.

  2. (x)

The diameter of $\operatorname{s}(\tau_{t}^{-1}(v))$ in $d$ is at most
$\epsilon$ for every $v\in\operatorname{Y}_{t}$.

  3. (xi)

If $v_{1},v_{2}\in\operatorname{Y}$ satisfy
$\tau_{h_{m}}(v_{1})=\tau_{h_{m}}(v_{2})$, then
$\psi_{m}\operatorname{\circ}q_{m,m+1}(\operatorname{s}(v_{1}))=\psi_{m}\operatorname{\circ}q_{m,m+1}(\operatorname{s}(v_{2}))$.

Indeed, we can construct $\operatorname{s}$ by again dividing
$\operatorname{Y}$ into the atoms of the Boolean algebra generated by the sets
$\tau_{h_{m}}^{-1}(W_{a})$ and then using one of the cross sections
$\operatorname{s}_{a}$ on each atom. This immediately gives (ix) and (x), and
then (xi) follows from (iii) above.
Let
$\rho_{\operatorname{s}}:\operatorname{C}^{k+1}(\operatorname{Y})\to\operatorname{Z}_{k}/B_{m+1}$
be the cocycle generated by $\operatorname{s}$.
Now for any fixed $\epsilon_{2}>0$, we note that if $\epsilon>0$ is small
enough, then property (x) implies the following fact, which tells us that
$\operatorname{s}$ is almost consistent with the factor
$\operatorname{Y}_{t}$:

$\forall\,\operatorname{c}_{1},\operatorname{c}_{2}\in\operatorname{C}^{k+1}(\operatorname{Y})\textrm{
with
}\tau_{t}\operatorname{\circ}\operatorname{c}_{1}=\tau_{t}\operatorname{\circ}\operatorname{c}_{2},\textrm{
we have
}d_{2}\big{(}\rho_{\operatorname{s}}(\operatorname{c}_{1})-\rho_{\operatorname{s}}(\operatorname{c}_{2})\big{)}\leq\epsilon_{2}.$
(17)

Indeed
$\tau_{t}\operatorname{\circ}\operatorname{c}_{1}=\tau_{t}\operatorname{\circ}\operatorname{c}_{2}$
tells us that for each $v$ the values
$\operatorname{c}_{1}(v),\operatorname{c}_{2}(v)$ are in the same fibre of
$\tau_{t}$ and so by (x) we have that
$d\big{(}\operatorname{s}\operatorname{\circ}\operatorname{c}_{1}(v),\operatorname{s}\operatorname{\circ}\operatorname{c}_{1}(v)\big{)}\leq\epsilon$
for all $v$. Then by continuity of $\kappa_{m+1}$ the values
$\operatorname{c}_{i}(v)$, $i=1,2$ are also close in $\operatorname{Y}$ for
each $v$. Therefore by Lemma 1.13 there exist
$\tilde{\operatorname{c}}_{1},\tilde{\operatorname{c}}_{2}\in\operatorname{C}^{k+1}(\operatorname{X}/_{B_{m+1}})$
such that
$d\big{(}\tilde{\operatorname{c}}_{1}(v),\tilde{\operatorname{c}}_{2}(v)\big{)}\leq\epsilon_{2}$
for every $v$ and such that
$\kappa_{m+1}\operatorname{\circ}\tilde{\operatorname{c}}_{i}=\operatorname{c}_{i}$,
$i=1,2$. Finally, from the expression
$\rho_{\operatorname{s}}(\operatorname{c}_{i})=\sigma_{k+1}(\operatorname{s}\operatorname{\circ}\operatorname{c}_{i}-\tilde{\operatorname{c}}_{i})$
we obtain the inequality in (17) by applying Lemma 7.7.
Note that property (xi) also implies that

$\forall\,\operatorname{c}_{1},\operatorname{c}_{2}\in\operatorname{C}^{k+1}(\operatorname{Y})\textrm{
with
}\tau_{h_{m}}\operatorname{\circ}\operatorname{c}_{1}=\tau_{h_{m}}\operatorname{\circ}\operatorname{c}_{2},\textrm{
we have
}\rho_{\operatorname{s}}(\operatorname{c}_{1})-\rho_{\operatorname{s}}(\operatorname{c}_{2})\in
B_{m}/B_{m+1}.$ (18)

Indeed, since $\psi_{m}$ is injective by (i), we have by (xi) that
$\tau_{h_{m}}\operatorname{\circ}\operatorname{c}_{1}=\tau_{h_{m}}\operatorname{\circ}\operatorname{c}_{2}$
implies
$q_{m,m+1}\operatorname{\circ}\operatorname{s}\operatorname{\circ}\operatorname{c}_{1}(v)=q_{m,m+1}\operatorname{\circ}\operatorname{s}\operatorname{\circ}\operatorname{c}_{2}(v)$,
so $\operatorname{s}\operatorname{\circ}\operatorname{c}_{1}(v)$,
$\operatorname{s}\operatorname{\circ}\operatorname{c}_{2}(v)$ are in the same
orbit of $B_{m}/B_{m+1}$ for every $v$. In particular we have
$\rho_{\operatorname{s}}(\operatorname{c}_{1})-\rho_{\operatorname{s}}(\operatorname{c}_{2})=\sigma_{k+1}(\operatorname{s}\operatorname{\circ}\operatorname{c}_{1}-\operatorname{s}\operatorname{\circ}\operatorname{c}_{2})$,
whence (18) follows.

To complete the proof we shall now use $\rho_{\operatorname{s}}$ to find a new
cross section
$\operatorname{s}^{\prime}:\operatorname{Y}\to\operatorname{X}/B_{m+1}$ that
is consistent with the factor $\operatorname{Y}_{t}$, and that is also
congruent to $\operatorname{s}$ modulo $B_{m}$, that is
$q_{m,m+1}\operatorname{\circ}\operatorname{s}^{\prime}=q_{m,m+1}\operatorname{\circ}\operatorname{s}$.
If we find $\operatorname{s}^{\prime}$ then, firstly, thanks to the
consistency, we can apply Lemma 7.6 with map $\psi=\tau_{t}$, obtaining a new
fibre-surjective factor $\operatorname{X}_{m+1}$ of
$\operatorname{X}/_{B_{m+1}}$ that is an extension of $\operatorname{Y}_{t}$
by $\operatorname{Z}_{k}/B_{m+1}$, and so (i) holds. Secondly
$\psi_{m}\operatorname{\circ}q_{m,m+1}$ factors through
$\operatorname{X}_{m+1}$, which yields $\psi_{m+1}^{\prime}$ satisfying (ii).
Indeed, by definition of the relation $\sim$ in Lemma 7.6 we have that
$x,y\in\operatorname{X}/_{B_{m+1}}$ are in the same fibre of $\psi_{m+1}$ if
and only if
$\tau_{t}\operatorname{\circ}\kappa_{m+1}(x)=\tau_{t}\operatorname{\circ}\kappa_{m+1}(y)$
and
$x-\operatorname{s}^{\prime}\operatorname{\circ}\kappa_{m+1}(x)=y-\operatorname{s}^{\prime}\operatorname{\circ}\kappa_{m+1}(y)$.
The first equality here implies, thanks to the congruence mod $B_{m}$ and
(xi), that
$\psi_{m}\operatorname{\circ}q_{m,m+1}(\operatorname{s}^{\prime}\operatorname{\circ}\kappa_{m+1}(x))=\psi_{m}\operatorname{\circ}q_{m,m+1}(\operatorname{s}^{\prime}\operatorname{\circ}\kappa_{m+1}(y))$,
and this together with the second equality gives
$\psi_{m}\operatorname{\circ}q_{m,m+1}(x)=\psi_{m}\operatorname{\circ}q_{m,m+1}(y)$.
Finally, property (iii) holds, since $x\sim
y\Rightarrow\tau_{t}\operatorname{\circ}\kappa_{m+1}(x)=\tau_{t}\operatorname{\circ}\kappa_{m+1}(y)$
implies that $\tau_{t}\operatorname{\circ}\kappa_{m+1}$ factors through
$\psi_{m+1}$, and it must then factor as $\pi_{m+1}$, by definition of
$\kappa_{m+1}$. We will have thus found the next term in the sequence $S$.

Averaging $\rho_{\operatorname{s}}$ to obtain a fibre-surjective factor
$\operatorname{X}_{m+1}$ of $\operatorname{X}/_{B_{m+1}}$: to find
$\operatorname{s}^{\prime}$, the idea is firstly to define a new function
$\rho^{\prime}$ by averaging $\rho_{\operatorname{s}}$, in such a way that the
approximate equality in (17) becomes an equality for $\rho^{\prime}$, and
secondly then to show that $\rho^{\prime}$ is itself a cocycle generated by
some cross section, which will be the desired $\operatorname{s}^{\prime}$.
Recall that, by [8, Lemma 3.3.12 (ii) & (iii)], for each $i\in\mathbb{N}$ the
map
$\beta_{i}:\operatorname{C}^{i}(\operatorname{Y})\to\operatorname{C}^{i}(\operatorname{Y}_{t})$,
$\operatorname{c}\mapsto\tau_{t}\operatorname{\circ}\operatorname{c}$ is a
totally surjective bundle morphism, and for every
$\operatorname{c}\in\operatorname{C}^{i}(\operatorname{Y}_{t})$ the preimage
$\beta_{i}^{-1}(\operatorname{c})$ is a $(k-1)$-fold sub-bundle of
$\operatorname{C}^{i}(\operatorname{Y})$. (Recall also Lemmas 2.16 and 2.17.)
We define
$\rho^{\prime}:\operatorname{C}^{k+1}(\operatorname{Y})\to\operatorname{Z}_{k}/B_{m+1}$
by

$\rho^{\prime}(\operatorname{c})=\mathbb{E}_{\operatorname{c}^{\prime}\in\beta_{k+1}^{-1}(\beta_{k+1}(\operatorname{c}))}\;\rho_{\operatorname{s}}(\operatorname{c}^{\prime}).$
(19)

The averaging here is relative to the Haar measure on
$\beta_{k+1}^{-1}(\beta_{k+1}(\operatorname{c}))$, and is well-defined for
$\epsilon_{2}$ sufficiently small, thanks to (17) (recall Definition 5.5). By
(18) and the fact that $t>h_{m}$, we have that
$\rho^{\prime}(\operatorname{c})-\rho_{\operatorname{s}}(\operatorname{c})\in
B_{m}/B_{m+1}$ for every
$\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{Y})$. Note also that
it follows clearly from (19) that

$\forall\,\operatorname{c}_{1},\operatorname{c}_{2}\in\operatorname{C}^{k+1}(\operatorname{Y})\textrm{
with
}\tau_{t}\operatorname{\circ}\operatorname{c}_{1}=\tau_{t}\operatorname{\circ}\operatorname{c}_{2},\textrm{
we have
}\rho^{\prime}(\operatorname{c}_{1})=\rho^{\prime}(\operatorname{c}_{2}).$
(20)

We shall now prove that $\rho^{\prime}$ is a cocycle by showing that it
inherits the required properties from $\rho_{\operatorname{s}}$ thanks to the
linearity of the averaging in (19). The required properties are the two axioms
from [8, Definition 3.3.14]. Axiom (i) follows straight from the same property
for $\rho_{\operatorname{s}}$ and linearity using the fact that any set
$\beta_{k+1}^{-1}(\beta_{k+1}(\operatorname{c}))$ is globally invariant under
composition with automorphisms in $\operatorname{Aut}(\\{0,1\\}^{k+1})$. To
see the second axiom we take two adjacent cubes
$\operatorname{c}_{1},\operatorname{c}_{2}\in\operatorname{C}^{k+1}(\operatorname{Y})$
with concatenation $\operatorname{c}_{3}$ and embed them into a
$(k+2)$-dimensional cube
$\operatorname{c}\in\operatorname{C}^{k+2}(\operatorname{Y})$ as restrictions
to two adjacent $(k+1)$-dimensional faces $F_{1}$ and $F_{2}$ in
$\\{0,1\\}^{k+2}$. The concatenation of $F_{1}$ and $F_{2}$ is a diagonal
subcube $F_{3}$. We have that the concatenation of $\operatorname{c}_{1}$ and
$\operatorname{c}_{2}$ is the restriction of $\operatorname{c}$ to $F_{3}$.
Note that the existence of $\operatorname{c}$ is guaranteed by simplicial
completion [8, Lemma 3.1.5]. By [8, Lemma 3.3.12 (iii)], we have a Haar
probability on $\Omega=\beta_{k+2}^{-1}(\beta_{k+2}(\operatorname{c}))$. Then,
by [8, Lemma 3.3.12 (iv)], the probability spaces
$\beta_{k+1}^{-1}(\beta_{k+1}(\operatorname{c}_{i}))$, $i=1,2,3$ are
faithfully embedded as factors and coupled in the big probability space
$\Omega$. Using the concatenation property for $\rho$ in $\Omega$ (when the
random cube is restricted to $F_{1},F_{2},F_{3}$) and linearity of expectation
we obtain that
$\rho^{\prime}(c_{3})=\rho^{\prime}(c_{1})+\rho^{\prime}(c_{2})$.

It remains to prove that the cocycle $\rho^{\prime}$ is generated by a cross
section. Let $\rho^{\prime\prime}$ denote the cocycle
$\rho^{\prime}-\rho_{\operatorname{s}}$, which takes values in $B_{m}/B_{m+1}$
(as noted just before (20)). It follows from (17) that
$d_{2}(\rho^{\prime\prime}(\operatorname{c}),0)\leq\epsilon_{2}$ for every
$\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{Y})$, so for
$\epsilon_{2}$ sufficiently small we have that $\rho^{\prime\prime}$ is a
coboundary, by Lemma 5.7. Thus for some Borel function $g:\operatorname{Y}\to
B_{m}/B_{m+1}$ we have
$\rho^{\prime\prime}(\operatorname{c})=\sigma_{k+1}(g\operatorname{\circ}\operatorname{c})$.
Hence, defining the Borel cross section
$\operatorname{s}^{\prime}:\operatorname{Y}\to\operatorname{X}/_{B_{m+1}}$ by
$\operatorname{s}^{\prime}(y)=\operatorname{s}(y)+g(y)$, we have
$\rho^{\prime}=\rho_{\operatorname{s}^{\prime}}$.

By (20) we have that $\operatorname{s}^{\prime}$ is consistent with the factor
$\operatorname{Y}_{t}$. Applying Lemma 7.6 as described above, we find the new
term in the sequence $S$.

This completes the proof of Theorem 7.3.

###  8 Rigidity of morphisms

Given a set $X$, a metric space $(Y,d)$, and maps $\phi,\phi^{\prime}:X\to Y$,
we say that $\phi^{\prime}$ is an _$\epsilon$ -modification_ of $\phi$ if for
every $x\in X$ we have $d(\phi(x),\phi^{\prime}(x))\leq\epsilon$.

######  Definition 8.1.

Let $\operatorname{X}$ be a compact nilspace, and let $\operatorname{Y}$ be a
$k$-step compact nilspace with a metric $d$ generating its topology. A map
$\phi:\operatorname{X}\to\operatorname{Y}$ is a $\delta$_-quasimorphism_ if
for every $\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{X})$ there
exists $\operatorname{c}^{\prime}\in\operatorname{C}^{k+1}(\operatorname{Y})$
such that
$d\big{(}\phi\operatorname{\circ}\operatorname{c}(v),\operatorname{c}^{\prime}(v)\big{)}\leq\delta$
for every $v\in\\{0,1\\}^{k+1}$.

In this section we establish the following result.

######  Theorem 8.2.

Let $\operatorname{Y}$ be a $k$-step compact nilspace of finite rank, with a
metric $d$ generating its topology. Then for every $\epsilon>0$ there exists
$\delta>0$ such that the following holds. If $\operatorname{X}$ is a compact
nilspace and $\phi:\operatorname{X}\to\operatorname{Y}$ is a Borel
$\delta$-quasimorphism, then $\phi$ has an $\epsilon$-modification that is a
continuous morphism.

In the proof we shall use the fact that the metric $d$ can be assumed to be
invariant under the action of the structure group $\operatorname{Z}_{k}$
(Lemma 1.11). We shall also use the following ‘rectification result’ for
cubes.

######  Lemma 8.3.

Let $\operatorname{X}$ be a $k$-step compact nilspace with metric $d$. For
every $\epsilon>0$ there exists $\delta>0$ such that the following holds. If
$\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{X})$ satisfies
$d^{\prime}\big{(}\pi_{k-1}\operatorname{\circ}\operatorname{c}(v,0),\pi_{k-1}\operatorname{\circ}\operatorname{c}(v,1)\big{)}\leq\delta$
for every $v\in\\{0,1\\}^{k}$, then $\operatorname{c}$ has an
$\epsilon$-modification
$\operatorname{c}^{\prime}\in\operatorname{C}^{k+1}(\operatorname{X})$ such
that
$\pi_{k-1}\operatorname{\circ}\operatorname{c}^{\prime}(v,0)=\pi_{k-1}\operatorname{\circ}\operatorname{c}^{\prime}(v,1)$
for every $v\in\\{0,1\\}^{k}$.

###### Proof.

Suppose for a contradiction that for some $\epsilon>0$ there is a sequence of
cubes $\operatorname{c}_{n}\in\operatorname{C}^{k+1}(\operatorname{X})$ such
that
$d^{\prime}\big{(}\pi_{k-1}\operatorname{\circ}\operatorname{c}_{n}(v,0),\pi_{k-1}\operatorname{\circ}\operatorname{c}_{n}(v,1)\big{)}\leq
1/n$ for every $v\in\\{0,1\\}^{k}$ and yet, for every cube
$\operatorname{c}^{\prime}\in\operatorname{C}^{k+1}(\operatorname{X})$ such
that
$\pi_{k-1}\operatorname{\circ}\operatorname{c}^{\prime}(v,0)=\pi_{k-1}\operatorname{\circ}\operatorname{c}^{\prime}(v,1)$
for all $v\in\\{0,1\\}^{k}$, there is some $v\in\\{0,1\\}^{k+1}$ such that
$d(\operatorname{c}_{n}(v),\operatorname{c}^{\prime}(v))>\epsilon$. By
compactness of $\operatorname{C}^{k+1}(\operatorname{X})$, there is a
subsequence $(\operatorname{c}_{m})$ of $(\operatorname{c}_{n})$ such that
$\operatorname{c}_{m}\to\operatorname{c}^{*}\in\operatorname{C}^{k+1}(\operatorname{X})$.
The topology on $\operatorname{C}^{k+1}(\operatorname{X})$ can be metrized by
$d_{\infty}(\operatorname{c}_{1},\operatorname{c}_{2}):=\max_{v\in\\{0,1\\}^{k+1}}d(\operatorname{c}_{1}(v),\operatorname{c}_{2}(v))$.
It then follows from $d_{\infty}(\operatorname{c}_{m},\operatorname{c}^{*})\to
0$ and the triangle inequality for $d^{\prime}$ that
$\pi_{k-1}\operatorname{\circ}\operatorname{c}^{*}(v,0)=\pi_{k-1}\operatorname{\circ}\operatorname{c}^{*}(v,1)$
for every $v\in\\{0,1\\}^{k}$. However, it also follows from
$\operatorname{c}_{m}\to\operatorname{c}^{*}$ that
$d(\operatorname{c}_{m}(v),\operatorname{c}^{*}(v))\leq\epsilon$ for all
$v\in\\{0,1\\}^{k+1}$, for sufficiently large $m$, and this contradicts our
initial assumption since
$\pi_{k-1}\operatorname{\circ}\operatorname{c}^{*}(\cdot,0)=\pi_{k-1}\operatorname{\circ}\operatorname{c}^{*}(\cdot,1)$.
∎

###### Proof of Theorem 8.2.

We argue by induction on $k$, starting from the trivial case $k=0$. For $k>0$,
suppose that the result holds for $k-1$, and fix any $\epsilon>0$. Let
$\delta>0$ be a parameter to be determined later, suppose that
$\phi:\operatorname{X}\to\operatorname{Y}$ is a $\delta$-quasimorphism, and
let $\phi_{1}=\pi_{k-1}\operatorname{\circ}\phi$. Then $\phi_{1}$ is a
$\delta$-quasimorphism into
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})$. By induction, for some
$\delta_{1}(\epsilon)>0$ to be fixed later, we have that if $\delta$ is small
enough then $\phi_{1}$ has a $\delta_{1}$-modification
$\phi_{2}:\operatorname{X}\to\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})$
that is a continuous morphism.

We shall now obtain a Borel measurable map
$\phi_{3}:\operatorname{X}\to\operatorname{Y}$ that lifts $\phi_{2}$, i.e.
such that $\pi_{k-1}\operatorname{\circ}\phi_{3}=\phi_{2}$, and which is a
$(\delta+\delta_{1})$-modification of $\phi$, so that $\phi_{3}$ is a
$\delta_{2}$-quasimorphism with $\delta_{2}=\delta_{1}+2\delta$. To obtain
this, the idea is first to obtain such a lift locally for each neighbourhood
in some appropriate cover of $\operatorname{X}$, and then combine the local
lifts into a global one. To this end we use the following set:

$G=\\{(x,y):\pi_{k-1}(y)=\phi_{2}(x)\\}\subset\operatorname{X}\times\operatorname{Y}.$

We claim that $G$ is compact. Indeed, on one hand the map $f_{1}\times
f_{2}:\operatorname{X}\times\operatorname{Y}\to\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})\times\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})$,
$(x,y)\mapsto(\phi_{2}(x),\pi_{k-1}(y))$ is continuous, and on the other hand
$(x,y)\in G$ if and only if $f_{1}\times f_{2}(x,y)$ is in the diagonal of
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})\times\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})$,
which is a closed set in the product topology since
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})$ is Hausdorff. Hence $G$
is closed in $\operatorname{X}\times\operatorname{Y}$ and therefore compact.
We also claim that $G$ is a $\operatorname{Z}_{k}$-bundle over
$\operatorname{X}$, where $\operatorname{Z}_{k}$ is the $k$-th structure group
of $\operatorname{Y}$. Indeed, the action of $\operatorname{Z}_{k}$ is given
by $a\cdot(x,y)=(x,y+a)$, and the projection map is just $(x,y)\mapsto
x\in\operatorname{X}$.
By Proposition 5.2, the bundle $G$ is locally trivial and so for every
$p\in\operatorname{X}$ we can find an open set $U_{p}\subset\operatorname{X}$
containing $p$ with a continuous cross section $U_{p}\to G$, which must then
be of the form $x\mapsto(x,\tau(x))$ for some continuous map
$\tau:U_{p}\to\operatorname{Y}$. Thus $\phi_{2}(x)=\pi_{k-1}(\tau(x))$ for
every $x\in U_{p}$. Then, by the definition of $d^{\prime}$, since for all
$x\in U_{p}$ we have

$d^{\prime}\big{(}\pi_{k-1}(\tau(x)),\pi_{k-1}(\phi(x))\big{)}=d^{\prime}(\phi_{2}(x),\phi_{1}(x))\leq\delta_{1},$

in particular for $p$ there exists $z_{p}\in\operatorname{Z}_{k}$ such that
$d\big{(}\tau(p)+z_{p},\phi(p)\big{)}\leq\delta_{1}$. But then, since the
function $f_{p}:x\mapsto\tau(x)+z_{p}$ is continuous on $U_{p}$, there is an
open set $U_{p}^{\prime}\subset U_{p}$ containing $p$ such that for all $x\in
U_{p}^{\prime}$ we have $d(\phi(x),\tau(x)+z_{p})<\delta_{1}+\delta$. The
function $f_{p}$ on $U^{\prime}_{p}$ is the desired local lift of $\phi_{2}$.
Now by compactness there is a finite covering of $\operatorname{X}$ by such
open sets $U_{p}^{\prime}$. Let $U_{1},\dots,U_{s}$ be the atoms of the
Boolean algebra generated by the sets $U_{p}^{\prime}$. For each $i\in[s]$ we
fix one of the functions $f_{p}$ defined on $U_{s}$ and rename it $f_{i}$. We
then define the Borel function $\phi_{3}$ by
$\phi_{3}(x)=\sum_{i\in[s]}1_{U_{i}}(x)f_{i}(x)$.

We shall now apply an averaging argument to $\phi_{3}$ that will produce a
continuous morphism $\phi_{4}$ which is close to $\phi$ as desired.

Let $P_{2}=\\{0,1\\}^{k+1}\setminus\\{0^{k+1}\\}$. Note that since $\phi_{2}$
is a morphism
$\operatorname{X}\to\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})$, it
preserves $k$-cubes, and since $\phi_{3}$ is a lift of $\phi_{2}$, by [8,
Remark 3.2.12] we have that $\phi_{3}$ also preserves $k$-cubes on
$\operatorname{Y}$. This implies that for every
$\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{X})$ the restriction
of $\phi_{3}\operatorname{\circ}\operatorname{c}$ to $P_{2}$ is a
$(k+1)$-corner on $\operatorname{Y}$. For any given cube
$\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{X})$ let us denote by
$\operatorname{K}_{0}(\operatorname{c})$ the value at $0^{k+1}$ of the unique
completion in $\operatorname{C}^{k+1}(\operatorname{Y})$ of
$(\phi_{3}\operatorname{\circ}\operatorname{c})|_{P_{2}}$. Let

$\phi_{4}(x)=\mathbb{E}_{\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X})}\,\operatorname{K}_{0}(\operatorname{c}).$
(21)

Let us show that this averaging is well-defined. Note that for every
$\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X})$ we have
$\operatorname{K}_{0}(\operatorname{c})\sim_{k-1}\phi_{3}(x)$, indeed since
the morphism $\phi_{2}$ preserves $(k+1)$-cubes, and $\phi_{3}$ is a lift of
$\phi_{2}$, we must have $\operatorname{K}_{0}(\operatorname{c})$ and
$\phi_{3}(x)$ both in the fibre $\pi_{k-1}^{-1}(\phi_{2}(x))$. We have to show
that if $\delta_{2}>0$ is small enough then the set of values
$\operatorname{K}_{0}(\operatorname{c})$,
$\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X})$ has small
diameter in the fibre. We will show that
$\operatorname{K}_{0}(\operatorname{c})$ is actually close to $\phi_{3}(x)$
for every $\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X})$,
which will also be useful later. For any
$\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X})$, since
$\phi_{3}$ is a $\delta_{2}$-quasimorphism, there is
$\operatorname{c}_{0}\in\operatorname{C}^{k+1}(\operatorname{Y})$ such that
for all $v$ we have
$d\big{(}\phi_{3}\operatorname{\circ}\operatorname{c}(v),\operatorname{c}_{0}(v)\big{)}\leq\delta_{2}$.
In particular, this inequality holds for all $v\in P_{2}$. By continuity of
the corner-completion (Lemma 1.12) it follows that for $\lambda>0$, if
$\delta_{2}$ is small enough then we have
$d\big{(}\operatorname{K}_{0}(\operatorname{c}),\operatorname{c}_{0}(0^{k+1})\big{)}\leq\lambda$.
Hence
$d\big{(}\phi_{3}(x),\operatorname{K}_{0}(\operatorname{c})\big{)}=d\big{(}\phi_{3}\operatorname{\circ}\operatorname{c}(0^{k+1}),\operatorname{K}_{0}(\operatorname{c})\big{)}\leq\delta_{2}+\lambda$.
We can now fix $\lambda$ so that the averaging in (21) is indeed well-defined.
Let us now prove that $\phi_{4}$ is a morphism. By [8, Lemma 3.2.13], it
suffices to show that for every
$\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{X})$ we have
$\phi_{4}\operatorname{\circ}\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{Y})$.
We shall do this using another averaging argument, but working this time with
the tricube $T_{k+1}$. Let $B=T_{k+1}\setminus\\{-1,1\\}^{k+1}$. For every
$t\in\hom_{\operatorname{c}\operatorname{\circ}\omega_{k+1}^{-1}}(T_{k+1},\operatorname{X})$,
there is a unique completion of $\phi_{3}\operatorname{\circ}t|_{B}$ to a
morphism $t^{\prime}:T_{k+1}\to\operatorname{Y}$. Let
$\operatorname{c}_{t}=t^{\prime}\operatorname{\circ}\omega_{k+1}$, which is in
$\operatorname{C}^{k+1}(\operatorname{Y})$ by [8, Lemma 3.1.16]. If
$\delta_{2}$ is small enough then the following function is well defined:

$\operatorname{c}_{2}:\\{0,1\\}^{k+1}\to\operatorname{Y},\;v\mapsto\mathbb{E}_{t\in\hom_{\operatorname{c}\operatorname{\circ}\omega_{k+1}^{-1}}(T_{k+1},\operatorname{X})}\,\operatorname{c}_{t}(v).$

Indeed, by Corollary 2.22, for each $v$ this average is equal to
$\mathbb{E}_{\operatorname{c}^{\prime}\in\operatorname{C}^{k+1}_{\operatorname{c}(v)}(\operatorname{X})}\operatorname{K}_{0}(\operatorname{c}^{\prime})=\phi_{4}(\operatorname{c}(v))$.
Thus, we have to show that
$\operatorname{c}_{2}\in\operatorname{C}^{k+1}(\operatorname{X})$. To see
this, recall that for every
$\operatorname{c}^{\prime}\in\operatorname{C}^{k+1}_{\operatorname{c}(v)}(\operatorname{X})$
we have
$\operatorname{K}_{0}(\operatorname{c}^{\prime})\sim_{k-1}\phi_{3}(\operatorname{c}(v))$,
and so
$\operatorname{c}_{2}(v)\sim_{k-1}\phi_{3}\operatorname{\circ}\operatorname{c}(v)$,
which implies that
$\pi_{k-1}\operatorname{\circ}\operatorname{c}_{2}=\phi_{2}\operatorname{\circ}\operatorname{c}\in\operatorname{C}^{k+1}(\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y}))$.
Therefore, by [8, Theorem 3.2.19] and the definition of degree-$k$ extensions,
we just have to check that for some (any) $t_{0}$ we have
$\sigma_{k+1}(\operatorname{c}_{2}-\operatorname{c}_{t_{0}})=0$. This follows
from linearity of averaging (Lemma 5.6) and the fact that for
$\operatorname{c}_{t},\operatorname{c}_{t_{0}}$ are cubes with the same
projection to $\operatorname{\mathcal{F}}_{k-1}(\operatorname{Y})$ for every
$t$, so

$\sigma_{k+1}(\operatorname{c}_{2}-\operatorname{c}_{t_{0}})\;=\;\sum_{v}(-1)^{|v|}\;\mathbb{E}_{t\in\hom_{\operatorname{c}\operatorname{\circ}\omega_{k+1}^{-1}}(T_{k+1},\operatorname{X})}\,\operatorname{c}_{t}(v)-\operatorname{c}_{t_{0}}(v)\;=\;\mathbb{E}_{t}\,\sigma_{k+1}\big{(}\operatorname{c}_{t}-\operatorname{c}_{t_{0}}\big{)}=0.$

Finally, let us prove that $\phi_{4}$ is continuous. The argument is similar
to the proof of Theorem 4.6. Consider the CSM structure on
$\pi_{0}:\operatorname{C}^{k+1}(\operatorname{X})\to\operatorname{X}$,
$\operatorname{c}\mapsto\operatorname{c}(0^{k+1})$, given by Lemma 2.17. For
each $v\in\\{0,1\\}^{k+1}\setminus\\{0^{k+1}\\}$ let
$\pi_{v}:\operatorname{C}^{k+1}(\operatorname{X})\to\operatorname{X}$,
$\operatorname{c}\mapsto\operatorname{c}(v)$. We have that $\pi_{v}$ is
continuous and each of its restrictions to a space
$\operatorname{C}^{k+1}_{x}(\operatorname{X})$ is measure-preserving, by Lemma
2.14. For each $v$ we let
$f_{v}:\operatorname{X}\to\operatorname{\mathcal{L}}(\operatorname{C}^{k+1}(\operatorname{X}),\operatorname{Y})$
be the function sending $x$ to the restriction of
$\phi_{3}\operatorname{\circ}\pi_{v}$ to
$\operatorname{C}_{x}^{k+1}(\operatorname{X})$. Then, just as in the proof of
Theorem 4.6, we have that $f_{v}$ is continuous, by Lemma 3.14. We now want to
express $\phi_{4}$ in terms of the functions $f_{v}$. To that end, consider
again the map
$\xi:\operatorname{X}\to\operatorname{\mathcal{L}}(\operatorname{C}^{k+1}(\operatorname{X}),\operatorname{Cor}^{k+1}(\operatorname{Y}))$,
sending $x$ to the function
$\xi_{x}:\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X})\mapsto(\operatorname{c}(v)=f_{v}(x)(\operatorname{c}))_{v\neq
0^{k+1}}$. Just as in the proof of Theorem 4.6, the continuity of each
function $f_{v}$ implies that $\xi$ is continuous. We then use again the
continuous map
$\operatorname{\mathcal{K}}:\operatorname{\mathcal{L}}(\operatorname{C}^{k+1}(\operatorname{X}),\operatorname{Cor}^{k+1}(\operatorname{Y}))\to\operatorname{\mathcal{L}}(\operatorname{C}^{k+1}(\operatorname{X}),\operatorname{Y})$
that sends a function $g$ to $g\operatorname{\circ}\operatorname{K}$, where
$\operatorname{K}$ is the unique completion of $(k+1)$-corners on
$\operatorname{Y}$. Now note that
$\operatorname{\mathcal{K}}\operatorname{\circ}\,\xi:\operatorname{X}\to\operatorname{\mathcal{L}}(\operatorname{C}^{k+1}(\operatorname{X}),\operatorname{Y})$
is precisely the map that sends each $x\in\operatorname{X}$ to the function
$\operatorname{c}\mapsto\operatorname{K}_{0}(\operatorname{c})$ on
$\operatorname{C}^{k+1}_{x}(\operatorname{X})$. This map is continuous, and by
the discussion justifying the averaging (21), we have that in fact
$\operatorname{\mathcal{K}}\operatorname{\circ}\,\xi$ takes values in the
following subset of
$\operatorname{\mathcal{L}}\big{(}\operatorname{C}^{k+1}(\operatorname{X}),\operatorname{Y}\big{)}$:

$\operatorname{\mathcal{U}}=\bigcup_{x\in\operatorname{X}}\Big{\\{}g\in
L\big{(}\operatorname{C}^{k+1}_{x}(\operatorname{X}),\pi_{k-1}^{-1}(\phi_{2}(x))\big{)}~{}:~{}\forall\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X}),\;\;d\big{(}g(\operatorname{c}),\phi_{3}(x)\big{)}\leq\delta_{2}+\lambda\Big{\\}}.$

Now $\phi_{4}$ is the composition of
$\operatorname{\mathcal{K}}\operatorname{\circ}\,\xi$ with the averaging
operator
$\operatorname{\mathcal{A}}:\,\operatorname{\mathcal{U}}\to\pi_{k-1}^{-1}(\phi_{2}(x))$
that sends a function $g$ to
$\mathbb{E}_{\operatorname{c}\in\operatorname{C}^{k+1}_{x}(\operatorname{X})}g(\operatorname{c})$.
Thus it now suffices to show that $\operatorname{\mathcal{A}}$ is continuous.
Note that since $\pi_{k-1}^{-1}(\phi_{2}(x))$ is homeomorphic to
$\operatorname{Z}_{k}$, it follows from the definition of the metric $d_{2}$
on $\operatorname{Z}_{k}$ that if $\delta_{2}+\lambda$ is sufficiently small
then every function $g\in\operatorname{\mathcal{U}}$ can be lifted
continuously to a function
$g^{\prime}:\operatorname{C}^{k+1}_{x}(\operatorname{X})\to\mathbb{R}^{n}$,
where $\operatorname{Z}_{k}=F\times\mathbb{T}^{n}$, in such a way that two
functions $g_{1},g_{2}\in\operatorname{\mathcal{U}}$ are close in the metric
$d_{1}$ from (8) if and only if their lifts $g_{1}^{\prime},g_{2}^{\prime}$
are close in the same metric but with $d$ now being the Euclidean distance on
$\mathbb{R}^{n}$. By Lemma 3.7, if $g_{n}\to g$ in the topology on
$\operatorname{\mathcal{L}}(\operatorname{C}^{k+1}(\operatorname{X}),\operatorname{Y})$
restricted to
$L(\operatorname{C}^{k+1}_{x}(\operatorname{X}),\operatorname{Y})$ , then
$d_{1}(g_{n},g)\to 0$, whence by the triangle inequality
$\operatorname{\mathcal{A}}(g_{n})\to\operatorname{\mathcal{A}}(g)$, so
$\operatorname{\mathcal{A}}$ is continuous as required. ∎

###  9 Characterizing compact connected nilspaces of finite rank

Recall from [8, Subsection 3.2.4] that given a $k$-step nilspace
$\operatorname{X}$ we denote by $\operatorname{\Theta}_{i}(\operatorname{X})$
the group of translations of height $i$ on $\operatorname{X}$ (or
$i$-translations). By a slight abuse of notation, when $\operatorname{X}$ is a
compact nilspace we shall write $\operatorname{\Theta}_{i}(\operatorname{X})$
for the group of $i$-translations that are also _continuous_ functions. A
central goal in this section is to show that if $\operatorname{X}$ has finite
rank then $\operatorname{\Theta}_{i}(\operatorname{X})$ is a Lie group for
each $i$ and $\operatorname{\Theta}_{1}(\operatorname{X})$ acts transitively
on the connected components of $\operatorname{X}$. This will then enable us to
show that if $\operatorname{X}$ has connected structure groups then it can be
identified with a filtered nilmanifold (Theorem 9.17).

Throughout this section we shall abbreviate ‘compact and finite-rank’ by
writing ‘cfr’.

######  Lemma 9.1.

Let $\operatorname{X}$ be a cfr $k$-step nilspace. Then every element of
$\operatorname{\Theta}(\operatorname{X})$ is a homeomorphism
$\operatorname{X}\to\operatorname{X}$ preserving the Haar measure.

###### Proof.

Each translation is an invertible continuous map from the compact Hausdorff
space $\operatorname{X}$ to itself and so its inverse is also continuous [32,
Theorem 26.6]. Moreover, the translation is a fibre-surjective automorphism of
$\operatorname{X}$, so it is measure preserving by Corollary 2.7. ∎

For a compact space $X$ and a space $Y$ with metric $d$, recall that $C(X,Y)$
denotes the space of continuous functions $f:X\to Y$, with the topology
induced by the uniform metric $d_{\infty}(f_{1},f_{2})=\sup_{x\in
X}d(f_{1}(x),f_{2}(x))$. We record the following basic fact.

######  Lemma 9.2.

Let $\operatorname{X}$ be a cfr $k$-step nilspace and let $d$ be a metric
generating the topology on $\operatorname{X}$. Then for every $i\in[k]$, the
group $\operatorname{\Theta}_{i}(\operatorname{X})$ equipped with the
restriction of the uniform metric on $C(\operatorname{X},\operatorname{X})$ is
a Polish group.

###### Proof.

The group $H(\operatorname{X})$ of homeomorphisms on $\operatorname{X}$, with
the relative topology from $C(X,X)$, is a Polish group [3, §1.3, Example (v)].
It follows from the definition of translations [8, Definition 3.2.27] and the
closure of cube sets that $\operatorname{\Theta}_{i}(\operatorname{X})$ is a
closed subgroup of $H(\operatorname{X})$, hence it is also a Polish group. By
definition the metric $d_{\infty}$ generates the topology on
$\operatorname{\Theta}_{i}(\operatorname{X})$. ∎

Recall that by [8, Lemma 3.2.31] a translation maps every class of the
relation $\sim_{k-1}$ onto another such class. This enables us to define a
translation on the factor
$\operatorname{X}_{k-1}=\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})$,
as in the following lemma. Recall also that the topology on
$\operatorname{X}_{k-1}$ is the quotient topology from $\operatorname{X}$,
which can be metrized by the quotient metric $d^{\prime}$ defined in (2). We
then denote by $d^{\prime}_{\infty}$ the uniform metric on
$\operatorname{\Theta}(\operatorname{X}_{k-1})$ relative to $d^{\prime}$.

######  Lemma 9.3.

For each $i\in\mathbb{N}$ let $h$ be the map sending each
$\alpha\in\operatorname{\Theta}_{i}(\operatorname{X})$ to the map $h(\alpha)$
on $\operatorname{X}_{k-1}$ defined by $h(\alpha)(y)=\pi_{k-1}(\alpha(x))$,
for any $x\in\operatorname{X}$ such that $\pi_{k-1}(x)=y$. Then $h$ is a
continuous homomorphism
$\operatorname{\Theta}_{i}(\operatorname{X})\to\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})$.

###### Proof.

That $h$ is a homomorphism
$\operatorname{\Theta}_{i}(\operatorname{X})\to\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})$
follows from the definitions. The continuity follows similarly, thus

$\displaystyle d^{\prime}_{\infty}\big{(}h(\alpha_{1}),h(\alpha_{2})\big{)}$
$\displaystyle=$
$\displaystyle\sup_{y\in\operatorname{X}_{k-1}}d^{\prime}\big{(}h(\alpha_{1})(y),h(\alpha_{2})(y)\big{)}\;\;=\;\;\sup_{x\in\operatorname{X}}d^{\prime}\big{(}\pi_{k-1}(\alpha_{1}(x)),\pi_{k-1}(\alpha_{2}(x))\big{)}$
$\displaystyle=$
$\displaystyle\sup_{x\in\operatorname{X}}\;\;\;\inf_{\begin{subarray}{c}x_{1}\sim_{k-1}\alpha_{1}(x)\\\
x_{2}\sim_{k-1}\alpha_{2}(x)\end{subarray}}d(x_{1},x_{2})\;\;\leq\;\;\sup_{x\in\operatorname{X}}d\big{(}\alpha_{1}(x),\alpha_{2}(x)\big{)}=d_{\infty}(\alpha_{1},\alpha_{2}).$

∎

An important result toward our goal in this section is that if an
$i$-translation on $\operatorname{X}_{k-1}$ is sufficiently close to the
identity then it can be lifted to an $i$-translation on $\operatorname{X}$, in
the following sense.

######  Lemma 9.4.

Let $\operatorname{X}$ be a cfr $k$-step nilspace and let $i\in\mathbb{N}$.
There exists $\epsilon>0$ such that if
$\alpha\in\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})$ satisfies
$d^{\prime}_{\infty}(\alpha,\mathrm{id})<\epsilon$ then there exists
$\beta\in\operatorname{\Theta}_{i}(\operatorname{X})$ such that
$h(\beta)=\alpha$.

###### Proof.

We shall use notation from [8, Lemma 3.3.38]. Recall that by that lemma the
translation bundle
$\mathcal{T}^{*}(\alpha,\operatorname{X},i)=\operatorname{\mathcal{F}}_{k-1}(\mathcal{T}(\alpha,\operatorname{X},i))$
is, from the purely algebraic viewpoint, a degree-$(k-i)$ extension of
$\operatorname{X}_{k-1}$ by $\operatorname{Z}_{k}$, and note that by the
results from Section 1 we have that this extension is a continuous
$\operatorname{Z}_{k}$-bundle. We show first that if $\epsilon$ is
sufficiently small then this extension has a measurable cross section
$\operatorname{s}$ such that the corresponding cocycle
$\rho_{\operatorname{s}}$ is a coboundary.
Let $\gamma$ be the projection
$\mathcal{T}^{*}(\alpha,\operatorname{X},i)\to\operatorname{X}_{k-1}$. We
claim that if $\epsilon>0$ is sufficiently small, then we can choose a Borel
cross section
$\operatorname{s}:\operatorname{X}_{k-1}\to\operatorname{\mathcal{T}}^{*}$
with the property that for each $\operatorname{s}(x)$, for every
$(x_{0},x_{1})$ in the equivalence class
$\pi_{k-1,\operatorname{\mathcal{T}}}^{-1}(\operatorname{s}(x))\subset\operatorname{\mathcal{T}}$,
we have $d(x_{0},x_{1})\leq\epsilon$. (Recall that we have
$\alpha(\pi_{k-1}(x_{0}))=\pi_{k-1}(x_{1})$ for
$(x_{0},x_{1})\in\operatorname{\mathcal{T}}$, by [8, Definition 3.3.34].)
Indeed, by definition $d^{\prime}_{\infty}(\alpha,\mathrm{id})<\epsilon$
implies that, for each $x\in\operatorname{X}_{k-1}$, there exist
$x_{0},x_{1}\in\operatorname{X}$ with $\pi_{k-1}(x_{0})=x$,
$\pi_{k-1}(x_{1})=\alpha(x)$, and such that $d(x_{0},x_{1})<\epsilon$. Then,
by $\operatorname{Z}_{k}$-invariance of $d$, we have that every pair
$(y_{0},y_{1})$ in the same equivalence class as $(x_{0},x_{1})$ in
$\operatorname{\mathcal{T}}^{*}$ satisfies $d(y_{0},y_{1})\leq\epsilon$. We
choose $\operatorname{s}(x)$ to be one of these pairs, say $(x_{0},x_{1})$.
Note that this choice can be made in a Borel measurable way. Indeed, using the
fact that $\operatorname{X}$ is a locally trivial
$\operatorname{Z}_{k}$-bundle over $\operatorname{X}_{k-1}$ (Proposition 5.2),
we can construct $\operatorname{s}$ as a piecewise continuous function.

Now let $\rho_{\operatorname{s}}$ be the cocycle generated by
$\operatorname{s}$, defined for
$\operatorname{c}\in\operatorname{C}^{k-i+1}(\operatorname{X}_{k-1})$ by
$\rho_{\operatorname{s}}(\operatorname{c})=\sigma_{k-i+1}(\operatorname{s}\operatorname{\circ}\operatorname{c}-\operatorname{c}^{\prime})$
for any lift
$\operatorname{c}^{\prime}\in\operatorname{C}^{k-i+1}(\operatorname{\mathcal{T}}^{*})$
of $\operatorname{c}$. We have that $\rho_{\operatorname{s}}$ is measurable
(recall the end of the proof of Lemma 4.5). We claim that, for some
$\epsilon_{2}>0$ to be fixed later, if $\epsilon$ is sufficiently small then
$\rho_{\operatorname{s}}$ is also small in the sense that
$d_{2}(\rho_{\operatorname{s}}(\operatorname{c}),0_{\operatorname{Z}_{k}})\leq\epsilon_{2}$
for every
$\operatorname{c}\in\operatorname{C}^{k-i+1}(\operatorname{X}_{k-1})$. To show
this we first give an alternative expression of the function
$\operatorname{s}\operatorname{\circ}\operatorname{c}-\operatorname{c}^{\prime}$.
The lift $\operatorname{c}^{\prime}$, being a cube on
$\operatorname{\mathcal{T}}^{*}$, has itself a lift
$\tilde{\operatorname{c}}\in\operatorname{C}^{k-i+1}(\operatorname{\mathcal{T}})$.
By definition we have
$\tilde{\operatorname{c}}=\tilde{\operatorname{c}}_{0}\times\tilde{\operatorname{c}}_{1}$
where
$\pi_{k-1}\operatorname{\circ}\tilde{\operatorname{c}}_{1}(v)=\alpha(\pi_{k-1}\operatorname{\circ}\tilde{\operatorname{c}}_{0}(v))$
for all $v$. By the claim in the previous paragraph, for each $v$ we have that
$\operatorname{s}\operatorname{\circ}\operatorname{c}(v)$ is a class of pairs
$(x_{0},x_{1})\in\pi_{k-1}^{-1}(\operatorname{c}(v))\times\pi_{k-1}^{-1}(\alpha\operatorname{\circ}\operatorname{c}(v))$
satisfying $d(x_{0},x_{1})\leq\epsilon$ and corresponding to a local
translation $\phi$, thus $x_{1}=\phi(x_{0})$ for every such pair. The
difference
$\operatorname{s}\operatorname{\circ}\operatorname{c}(v)-\operatorname{c}^{\prime}(v)$
is then the element $a_{v}\in\operatorname{Z}_{k}$ which has to be added to
$\tilde{\operatorname{c}}_{0}(v)$ in order to have
$\phi(\tilde{\operatorname{c}}_{0}(v)+a_{v})=\tilde{\operatorname{c}}_{1}(v)$,
namely
$a_{v}=\phi^{-1}(\tilde{\operatorname{c}}_{1}(v))-\tilde{\operatorname{c}}_{0}(v)$.
Thus, letting $a$ denote the function
$\\{0,1\\}^{k-i+1}\to\operatorname{Z}_{k}$, $v\mapsto a_{v}$, we have
$\rho_{\operatorname{s}}(\operatorname{s}\operatorname{\circ}\operatorname{c}-\operatorname{c}^{\prime})=\sigma_{k-i+1}(a)$.
To show that this must be a small element of $\operatorname{Z}_{k}$, we argue
as follows. By assumption on $\alpha$, the cube $\tilde{\operatorname{c}}$
satisfies the premise of Lemma 8.3 with $\delta=\epsilon$. Thus, given
$\epsilon_{1}>0$ to be fixed later, if $\epsilon<\epsilon_{1}$ is sufficiently
small then by that lemma there must exist
$\operatorname{c}^{*}=\operatorname{c}^{*}_{0}\times\operatorname{c}^{*}_{1}\in\operatorname{C}^{k-i+1}(\operatorname{\mathcal{T}})$
such that for all $v$ we have
$d(\operatorname{c}^{*}_{i}(v),\tilde{\operatorname{c}}_{i}(v))\leq\epsilon_{1}$
for $i=0,1$, and with
$\pi_{k-1}\operatorname{\circ}\operatorname{c}^{*}_{1}=\pi_{k-1}\operatorname{\circ}\operatorname{c}^{*}_{0}$.
For each $v$ let
$a^{*}(v)=\operatorname{c}^{*}_{1}(v)-\operatorname{c}^{*}_{0}(v)\in\operatorname{Z}_{k}$.
It now suffices to show that $d_{2}(a^{*}(v),a(v))\leq\epsilon_{2}/2^{k-i+1}$
for every $v$, for then, by virtue of
$\langle\operatorname{c}^{*}_{0},\operatorname{c}^{*}_{1}\rangle_{1}$ being a
cube, we must have $\sigma_{k-i+1}(a^{*})=0$ and so
$\sigma_{k-i+1}(a)\leq\epsilon_{2}$ as claimed. To show that
$d_{2}(a^{*}(v),a(v))$ is small we can apply Lemma 7.7 with
$\delta=2\epsilon_{1}$, since we know on one hand that
$d(\operatorname{c}_{0}^{*}(v),\tilde{\operatorname{c}}_{0}(v))\leq\epsilon_{1}$,
and on the other hand that
$d(\phi^{-1}(\tilde{\operatorname{c}}_{1}(v)),\tilde{\operatorname{c}}_{1}(v))\leq\epsilon$
and
$d(\operatorname{c}_{1}^{*}(v),\tilde{\operatorname{c}}_{1}(v))\leq\epsilon_{1}$,
so that
$d(\phi^{-1}(\tilde{\operatorname{c}}_{1}(v)),\operatorname{c}_{1}^{*}(v))\leq\epsilon+\epsilon_{1}\leq
2\epsilon_{1}$.

We can now apply Lemma 5.7. Thus if $\epsilon_{2}$ is sufficiently small then
there exists a Borel function
$g:\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\to\operatorname{Z}_{k}$
such that
$\rho_{\operatorname{s}}(\operatorname{c})=\sigma_{k-1+i}(g\operatorname{\circ}\operatorname{c})$
for all
$\operatorname{c}\in\operatorname{C}^{k-i+1}\big{(}\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\big{)}$.
Let
$m:\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})\to\operatorname{\mathcal{T}}^{*}$
be the measurable function $x\mapsto\operatorname{s}(x)-g(x)$. We have that
$m$ is a morphism, indeed for any
$\operatorname{c}\in\operatorname{C}^{n}(\operatorname{\mathcal{F}}_{k-1}(\operatorname{X}))$,
on one hand we clearly have that the $\operatorname{\mathcal{T}}^{*}$-valued
map $m\operatorname{\circ}\operatorname{c}$ is a lift of $\operatorname{c}$,
and on the other hand for some (any) lift
$\operatorname{c}^{\prime}\in\operatorname{C}^{n}(\operatorname{\mathcal{T}}^{*})$
of $\operatorname{c}$ we have
$\sigma_{k-i+1}(m\operatorname{\circ}\operatorname{c}-\operatorname{c}^{\prime})=\sigma_{k-i+1}(\operatorname{s}\operatorname{\circ}\operatorname{c}-\operatorname{c}^{\prime})-\sigma_{k-i+1}(g\operatorname{\circ}\operatorname{c})=\rho_{\operatorname{s}}(\operatorname{c})-\rho_{\operatorname{s}}(\operatorname{c})=0$,
so by [8, Definition 3.3.13 (ii)] we have indeed
$m\operatorname{\circ}\operatorname{c}\in\operatorname{C}^{n}(\operatorname{\mathcal{T}}^{*})$.
Now [8, Proposition 3.3.39] gives us an $i$-translation $\beta$ on
$\operatorname{X}$ that is a lift of $\alpha$, and is defined as follows: for
each $x\in\operatorname{X}$ we have $\beta(x)=\phi(x)$, where $\phi$ is the
local translation corresponding to the equivalence class
$m\operatorname{\circ}\pi_{k-1}(x)\in\operatorname{\mathcal{T}}^{*}$. It only
remains to check that $\beta$ is Borel measurable, as then, being a morphism,
it must be continuous by Theorem 4.6. By [8, Definition 3.3.34 and Proposition
3.3.36], the nilspace $\operatorname{\mathcal{T}}$ is a continuous
$\operatorname{Z}$-bundle over $\operatorname{\mathcal{T}}^{*}$, for the
polish group
$\operatorname{Z}=\\{(z,z):z\in\operatorname{Z}_{k}\\}\leq\operatorname{Z}_{k}\times\operatorname{Z}_{k}$.
Therefore, arguing as in the end of the proof of Lemma 4.5, we obtain a Borel
cross section
$\lambda:\operatorname{\mathcal{T}}^{*}\to\operatorname{\mathcal{T}}$, and so
the map
$\lambda\operatorname{\circ}m\operatorname{\circ}\pi_{k-1}:\operatorname{X}\to\operatorname{\mathcal{T}}$
is Borel. Moreover, letting
$\lambda\operatorname{\circ}m\operatorname{\circ}\pi_{k-1}(x)=(y_{0},y_{1})$,
we have $\beta(x)=y_{1}+(x-y_{0})$, so $\beta$ is indeed Borel. ∎

We shall need a useful criterion for a translation to lie in the kernel of
$h$. Note that if $\alpha\in\ker(h)$ then, since by [8, Lemma 3.2.31] the
restriction of $\alpha$ to each fibre of $\pi_{k-1}$ is a local translation,
we deduce that the map $x\mapsto\alpha(x)-x$ is a constant element of
$\operatorname{Z}_{k}$ for every $x$ in a given fibre. Thus $\alpha$ induces a
well-defined map
$\alpha^{\prime}:\operatorname{X}_{k-1}\to\operatorname{Z}_{k}$,
$\pi_{k-1}(x)\mapsto\alpha(x)-x$. Conversely, given
$\alpha^{\prime}:\operatorname{X}_{k-1}\to\operatorname{Z}_{k}$ we can define
$\alpha:\operatorname{X}\to\operatorname{X}$, $x\mapsto
x+\alpha^{\prime}(\pi_{k-1}(x))$, and we can ask when is $\alpha$ in
$\operatorname{\Theta}(\operatorname{X})$.

######  Lemma 9.5.

Let $i<k$. Then
$\alpha\in\ker(h)\cap\operatorname{\Theta}_{i}(\operatorname{X})$ if and only
if
$\alpha^{\prime}\in\hom(\operatorname{X}_{k-1},\operatorname{\mathcal{D}}_{k-i}(\operatorname{Z}_{k}))$.

###### Proof.

By [8, Lemma 3.2.32] we know that
$\alpha\in\operatorname{\Theta}_{i}(\operatorname{X})$ if and only if for
every $\operatorname{c}\in\operatorname{C}^{n}(\operatorname{X})$ we have
$\langle\operatorname{c},\alpha\operatorname{\circ}\operatorname{c}\rangle_{i}\in\operatorname{C}^{n+i}(\operatorname{X})$.
If $\alpha\in\ker(h)\cap\operatorname{\Theta}_{i}(\operatorname{X})$ then we
can take the difference
$\alpha\operatorname{\circ}\operatorname{c}-\operatorname{c}=\alpha^{\prime}\operatorname{\circ}\operatorname{c}^{\prime}$
for $\operatorname{c}^{\prime}=\pi_{k-1}\operatorname{\circ}\operatorname{c}$,
and by definition of degree-$k$ extensions this difference must be a cube in
$\operatorname{\mathcal{D}}_{k}(\operatorname{Z}_{k})$. But we also have
$\langle\operatorname{c},\alpha\operatorname{\circ}\operatorname{c}\rangle_{i}-\langle\operatorname{c},\operatorname{c}\rangle_{i}\in\operatorname{C}^{n+i}(\operatorname{\mathcal{D}}_{k}(\operatorname{Z}_{k}))$,
and this equals $\langle
0,\alpha^{\prime}\operatorname{\circ}\operatorname{c}^{\prime}\rangle_{i}$. By
[8, Lemma 3.3.37], we have $\langle
0,\alpha^{\prime}\operatorname{\circ}\operatorname{c}^{\prime}\rangle_{i}\in\operatorname{C}^{n+i}(\operatorname{\mathcal{D}}_{k}(\operatorname{Z}_{k}))$
if and only if
$\alpha^{\prime}\operatorname{\circ}\operatorname{c}^{\prime}\in\operatorname{C}^{n}(\operatorname{\mathcal{D}}_{k-i}(\operatorname{Z}_{k})$.
The converse follows similarly. ∎

The next main tool that we need, Lemma 9.7 below, is a type of rigidity result
for morphisms between abelian torsors of the form
$\operatorname{\mathcal{D}}_{k}(\operatorname{Z})$. The proof will use the
following basic fact.

######  Lemma 9.6.

Let $\operatorname{Z}^{\prime}$ be a cfr abelian group, and let $d_{2}$ be the
metric from Definition 5.4. Then there exists $\eta>0$ such that for every
compact abelian group $\operatorname{Z}$ and every non-constant continuous
affine homomorphism $\phi:\operatorname{Z}\to\operatorname{Z}^{\prime}$, there
exist $x,y\in\operatorname{Z}$ such that $d_{2}(\phi(x),\phi(y))\geq\eta$.

###### Proof.

We can assume without loss that $\phi$ is a homomorphism (not just an affine
one). If $\operatorname{Z}^{\prime}$ is a finite group then the claim is
verified by any two points $x,y$ such that $\phi(x)\neq\phi(y)$. We may
therefore suppose that $\operatorname{Z}^{\prime}=F\times\mathbb{T}^{n}$ with
$n>0$ and $F$ a finite abelian group, and that for some $i\in[n]$ the
projection $\pi_{i}:\mathbb{T}^{n}\to\mathbb{T}$, $x\mapsto x_{i}$ satisfies
that $\pi_{i}\operatorname{\circ}\phi(\operatorname{Z})$ is a nontrivial
subgroup of $\mathbb{T}$. Identifying $\mathbb{T}^{n}$ with $[0,1)^{n}$, there
is then $y\in\operatorname{Z}$ such that
$|\pi_{i}\operatorname{\circ}\phi(y)-0|_{\mathbb{T}}\geq 1/4$ and so with
$x=0_{\operatorname{Z}}$ we have $d_{2}(\phi(x),\phi(y))\geq 1/4$. ∎

######  Lemma 9.7.

Let $k,\ell\in\mathbb{N}$, let $\operatorname{Z},\operatorname{Z}^{\prime}$ be
compact abelian groups, and suppose that $\operatorname{Z}^{\prime}$ has
finite rank. Then there exists
$\epsilon=\epsilon(\ell,\operatorname{Z}^{\prime})>0$ such that if
$\phi\in\hom(\operatorname{\mathcal{D}}_{k}(\operatorname{Z}),\operatorname{\mathcal{D}}_{\ell}(\operatorname{Z}^{\prime}))$
satisfies $d_{2}(\phi(x),\phi(y))\leq\epsilon$ for every
$x,y\in\operatorname{Z}$ then $\phi$ is a constant function.

###### Proof.

Since
$\hom(\operatorname{\mathcal{D}}_{k}(\operatorname{Z}),\operatorname{\mathcal{D}}_{\ell}(\operatorname{Z}^{\prime}))\subseteq\hom(\operatorname{\mathcal{D}}_{1}(\operatorname{Z}),\operatorname{\mathcal{D}}_{\ell}(\operatorname{Z}^{\prime}))$
we can assume that $k=1$. Let $\phi$ be an arbitrary non-constant morphism
from $\operatorname{\mathcal{D}}_{1}(\operatorname{Z})$ to
$\operatorname{\mathcal{D}}_{\ell}(\operatorname{Z}^{\prime})$. As mentioned
in [8, Example 2.2.13] (recall also [8, Definition 2.2.30]), the map $\phi$ is
a polynomial map of degree at most $\ell$. Thus, if for every
$t\in\operatorname{Z}$ and every
$f:\operatorname{Z}\to\operatorname{Z}^{\prime}$ we denote by $\Delta_{t}f$
the function $x\mapsto f(x+t)-f(x)$, then there is $i<\ell$ and elements
$t_{1},t_{2},\dots,t_{i}\in\operatorname{Z}$ such that
$\phi^{\prime}=\Delta_{t_{1}}\operatorname{\circ}\Delta_{t_{2}}\operatorname{\circ}\cdots\operatorname{\circ}\Delta_{t_{i}}\phi$
is non-constant but $\Delta_{t}\phi^{\prime}$ is constant for every
$t\in\operatorname{Z}$. It follows that $\phi^{\prime}$ is a non-constant
continuous affine homomorphism from $\operatorname{Z}$ to
$\operatorname{Z}^{\prime}$, so by Lemma 9.6 there are
$x,y\in\operatorname{Z}$ with
$d_{2}(\phi^{\prime}(x),\phi^{\prime}(y))\geq\eta(\operatorname{Z}^{\prime})>0$.
This cannot hold if $\max_{x,y}d_{2}(\phi(x),\phi(y))$ is too small, so this
quantity must have a positive lower bound (depending only on
$\operatorname{Z}^{\prime}$ and $\ell$). ∎

Lemma 9.7 has the following consequence.

######  Corollary 9.8.

Let $\ell\in\mathbb{N}$, let $\operatorname{X}$ be a $k$-step compact
nilspace, and let $\operatorname{Z}$ be a cfr abelian group. Then there exists
$\epsilon=\epsilon(\ell,\operatorname{Z})>0$ such that if
$\phi\in\hom(\operatorname{X},\operatorname{\mathcal{D}}_{\ell}(\operatorname{Z}))$
satisfies $d_{2}(\phi(x),\phi(y))\leq\epsilon$ for every
$x,y\in\operatorname{X}$ then $\phi$ is constant. In particular, for any
$x_{0}\in\operatorname{X}$, $z_{0}\in\operatorname{Z}$, the set
$Y=\\{\phi\in\hom(\operatorname{X},\operatorname{\mathcal{D}}_{\ell}(\operatorname{Z})):\phi(x_{0})=z_{0}\\}$,
equipped with the metric
$d_{\infty}(\phi,\phi^{\prime})=\max_{x\in\operatorname{X}}d_{2}(\phi(x),\phi^{\prime}(x))$,
is discrete.

###### Proof.

Suppose that $d_{2}(\phi(x),\phi(y))<\epsilon$ for every
$x,y\in\operatorname{X}$, where $\epsilon=\epsilon(\ell,\operatorname{Z})$ is
the constant from Lemma 9.7. We prove by induction on $k$ that $\phi$ is
constant.
If $k=1$ then $\operatorname{X}$ is abelian and the result follows from Lemma
9.7. Suppose that the statement holds for $k-1$. Then Lemma 9.7 tells us that
$\phi$ is constant on the $\sim_{k-1}$ classes of $\operatorname{X}$. This
means that $\phi$ can be regarded as a function on
$\operatorname{\mathcal{F}}_{k-1}(\operatorname{X})$, and so by our assumption
$\phi$ is constant.
To see the last sentence in the corollary, note that if $\phi,\phi^{\prime}\in
Y$ satisfy
$d_{\infty}(\phi,\phi^{\prime})=d_{\infty}(\phi-\phi^{\prime},0)\leq\epsilon/2$,
then by the triangle inequality $\phi-\phi^{\prime}$ satisfies the premise of
the previous sentence in the corollary, and then by that sentence and the
definition of $Y$ we deduce that $\phi-\phi^{\prime}$ must be the constant
$0$. ∎

With these results we can now give a useful description of the kernel of $h$.

######  Lemma 9.9.

Let $\operatorname{X}$ be a cfr $k$-step nilspace, and let
$h:\operatorname{\Theta}(\operatorname{X})\to\operatorname{\Theta}(\operatorname{X}_{k-1})$
be the homomorphism from Lemma 9.3. Then $\ker(h)$ is isomorphic as a
topological group to $F\times\operatorname{Z}_{k}$ for some discrete group
$F$. In particular $\ker(h)$ is a Lie group.

###### Proof.

Let $x\in\operatorname{X}$ be arbitrary and let $F$ be the stabilizer
$\operatorname{Stab}_{\ker(h)}(x)=\\{\alpha\in\ker(h):\alpha(x)=x\\}$. Let
$\tau:\operatorname{Z}_{k}\to\ker(h)$ be the map sending
$z\in\operatorname{Z}_{k}$ to the translation $\tau_{z}:x\mapsto x+z$, and
note that $\tau$ is an isomorphism of topological groups between
$\operatorname{Z}_{k}$ and $\tau(\operatorname{Z}_{k})\leq\ker(h)$. Now given
any $\alpha\in\ker(h)$, letting $z=\alpha(x)-x$ we have that
$\alpha-\tau_{z}\in F$, so $\ker(h)=F\cdot\tau(\operatorname{Z}_{k})$.
Moreover, since every $\alpha\in F$ must in fact stabilize every point in the
fibre of $x$ (as the trivial local translation from this fibre to itself), it
follows that $F\lhd\,\ker(h)$. We also have
$\tau(\operatorname{Z}_{k})\lhd\,\ker(h)$. (In fact
$\tau(\operatorname{Z}_{k})\subset Z(\ker(h))$.) Using Lemma 9.5 and Corollary
9.8 we see that $F$ is discrete. It follows that $\ker(h)\cong
F\times\operatorname{Z}_{k}$ as claimed. Since $\operatorname{Z}_{k}$ is a Lie
group, the proof is complete. ∎

If $G$ is a topological group then we denote the connected component of
$\mathrm{id}_{G}$ by $G^{0}$. This is a closed normal subgroup of $G$. It is
also standard that $G$ is a Lie group if and only if $G^{0}$ is a Lie group.

######  Theorem 9.10.

Let $\operatorname{X}$ be a cfr $k$-step nilspace and let $i\in[k]$. Then the
following statements hold.

  1. (i)

$\operatorname{\Theta}_{i}(\operatorname{X})$ is a Lie group,

  2. (ii)

$h\big{(}\operatorname{\Theta}_{i}(\operatorname{X})^{0}\big{)}=\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}$.

###### Proof.

We prove the statements by induction on $k$. The case $k=0$ being trivial, let
$k>0$ and suppose that the statements hold for $k-1$.

To see statement $(i)$, note first that since $h$ is a continuous homomorphism
and $\operatorname{\Theta}_{i}(\operatorname{X})$ is closed, we have that
$h(\operatorname{\Theta}_{i}(\operatorname{X}))$ is a closed subgroup of
$\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})$. By induction the latter
is a Lie group, so by Cartan’s theorem
$h(\operatorname{\Theta}_{i}(\operatorname{X}))$ is a Lie group [41, Theorem
2.12.6]. By Lemma 9.9 we have that $\ker(h)$ is a Lie group, and so
$H:=\operatorname{\Theta}_{i}(\operatorname{X})\cap\ker(h)$ is a Lie group
(being a closed subgroup of $\ker(h)$). On the other hand
$h(\operatorname{\Theta}_{i}(\operatorname{X}))$ is isomorphic to
$\operatorname{\Theta}_{i}(\operatorname{X})/H$ as a topological group (see
[3, Theorem 1.2.6]). Therefore $\operatorname{\Theta}_{i}(\operatorname{X})/H$
must be a Lie group (this can be seen using [13, Theorem 3.1]). We can now
deduce that $\operatorname{\Theta}_{i}(\operatorname{X})$ is itself a Lie
group, by [25, Lemma A.3].

Next we show that

$\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}\subseteq
h(\operatorname{\Theta}_{i}(\operatorname{X})).$ (22)

To see this we use that $\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})$ is
a Lie group and so every element
$\alpha\in\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}$ is connected
to the identity by a continuous path
$p:[0,1]\to\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})$ with
$p(0)=\mathrm{id}$ and $p(1)=\alpha$. For $n\in\mathbb{N}$ let
$\alpha_{i}=p((i-1)/n)^{-1}p(i/n)$ for $i\in[n]$ and let
$\alpha=\prod_{i=1}^{n}\alpha_{i}$. Lemma 9.4 implies that if $n$ is
sufficiently large then for every $\alpha_{i}$ there is
$\beta_{i}\in\operatorname{\Theta}_{i}(\operatorname{X})$ with
$h(\beta_{i})=\alpha_{i}$. Let $\beta=\prod_{i=1}^{n}\beta_{i}$. Since $h$ is
a homomorphism we have $h(\beta)=\alpha$.

To obtain statement $(ii)$, we first show that

$h(\operatorname{\Theta}_{i}(\operatorname{X})^{0})=h(\operatorname{\Theta}_{i}(\operatorname{X}))^{0}.$
(23)

On one hand we have $h(\operatorname{\Theta}_{i}(\operatorname{X})^{0})\subset
h(\operatorname{\Theta}_{i}(\operatorname{X}))^{0}$ since $h$ is continuous.
On the other hand $h(\operatorname{\Theta}_{i}(\operatorname{X}))^{0}$ is open
in $h(\operatorname{\Theta}_{i}(\operatorname{X}))$ and $h$ is an open map
$\operatorname{\Theta}_{i}(\operatorname{X})\to
h(\operatorname{\Theta}_{i}(\operatorname{X}))$ (again by [3, Theorem 1.2.6]),
so $h(\operatorname{\Theta}_{i}(\operatorname{X})^{0})$ is open in
$h(\operatorname{\Theta}_{i}(\operatorname{X}))$. Since it is also closed, we
have that both $h(\operatorname{\Theta}_{i}(\operatorname{X})^{0})$ and its
complement in $h(\operatorname{\Theta}_{i}(\operatorname{X}))^{0}$ are open,
so this complement must be empty, since
$h(\operatorname{\Theta}_{i}(\operatorname{X}))^{0}$ is connected, and (23)
follows. Now in statement $(ii)$, the inclusion
$h(\operatorname{\Theta}_{i}(\operatorname{X})^{0})\subset\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}$
follows by continuity of $h$, and for the opposite inclusion, note that by
(22) we have $\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}\subseteq
h(\operatorname{\Theta}_{i}(\operatorname{X}))^{0}$, so by (23) we have
$\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}\subseteq
h(\operatorname{\Theta}_{i}(\operatorname{X})^{0})$. ∎

######  Remark 9.11.

It follows from statement $(ii)$ above that
$\operatorname{\Theta}_{i}(\operatorname{X})^{0}$ is a topological extension
of $\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}$ by
$\ker(h)\cap\operatorname{\Theta}_{i}(\operatorname{X})^{0}$, that is we have
the short exact sequence

$0\;\;\xrightarrow{\makebox[14.22636pt]{}}\;\;\ker(h)\cap\operatorname{\Theta}_{i}(\operatorname{X})^{0}\;\;\xrightarrow{\makebox[14.22636pt]{$\iota$}}\;\;\operatorname{\Theta}_{i}(\operatorname{X})^{0}\;\;\xrightarrow{\makebox[14.22636pt]{$h$}}\;\;\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}\;\;\xrightarrow{\makebox[14.22636pt]{}}\;\;0.$

This gives another way to obtain statement $(i)$ by induction given $(ii)$,
using that a topological extension of a Lie group by a Lie group is again a
Lie group (see [40, §2.6]).

######  Corollary 9.12.

The Lie group $\operatorname{\Theta}(\operatorname{X})^{0}$ acts transitively
on the connected components of $\operatorname{X}$.

###### Proof.

We argue by induction on $k$. For $k>0$ suppose that
$\operatorname{\Theta}(\operatorname{X}_{k-1})^{0}$ acts transitively on the
connected components of $\operatorname{X}_{k-1}$. Let $\tau$ be the
isomorphism
$\operatorname{Z}_{k}\to\tau(\operatorname{Z}_{k})\leq\operatorname{\Theta}(\operatorname{X})$
in the proof of Lemma 9.9. Consider the group
$\tau(\operatorname{Z}_{k})\cdot\operatorname{\Theta}(\operatorname{X})^{0}=\\{\tau(z)\,\alpha:z\in\operatorname{Z}_{k},\,\alpha\in\operatorname{\Theta}(\operatorname{X})^{0}\\}\leq\operatorname{\Theta}(\operatorname{X})$,
and let $M$ be any connected component of $\operatorname{X}$. We claim that
$\tau(\operatorname{Z}_{k})\cdot\operatorname{\Theta}(\operatorname{X})^{0}$
acts transitively on $M$. Indeed, for any $x,y\in M$, by Theorem 9.10 (ii) and
the induction hypothesis, there exists
$\alpha\in\operatorname{\Theta}(\operatorname{X})^{0}$ such that
$\pi_{k-1}\operatorname{\circ}\alpha(x)=\pi_{k-1}(y)$. Combining this with the
transitivity of $\operatorname{Z}_{k}$ on the fibres of $\pi_{k-1}$ we deduce
that there exists
$\alpha^{\prime}\in\tau(\operatorname{Z}_{k})\cdot\operatorname{\Theta}(\operatorname{X})^{0}$
such that $\alpha^{\prime}(x)=y$, which proves our claim. It follows that
$\operatorname{\Theta}(\operatorname{X})$ acts transitively on $M$, and we can
then deduce that $\operatorname{\Theta}(\operatorname{X})^{0}$ also acts
transitively on $M$ by standard results (e.g. [23, Chapter II, Theorem 3.2 and
Proposition 4.3]). ∎

######  Example 9.13.

The main results of this section so far can be illustrated with the Heisenberg
nilmanifold $H/\Gamma$, where
$H=\begin{pmatrix}1&\mathbb{R}&\mathbb{R}\\\\[1.00006pt]
&1&\mathbb{R}\\\\[1.00006pt] &&1\end{pmatrix}$,
$\Gamma=\begin{pmatrix}1&\mathbb{Z}&\mathbb{Z}\\\\[1.00006pt]
&1&\mathbb{Z}\\\\[1.00006pt] &&1\end{pmatrix}$ (recall [8, Example 2.3.2]).
Let $\operatorname{X}$ denote $H/\Gamma$ equipped with the cubes associated
with the lower central series on $H$. We then have that $\operatorname{X}$ is
a 2-step compact nilspace, with 1-step factor
$\operatorname{X}_{1}=\mathbb{T}^{2}$ equipped with the standard degree-1
cubes, and we compute that

$\operatorname{\Theta}_{1}(\operatorname{X})=\begin{pmatrix}1&\mathbb{R}&\mathbb{T}\\\\[1.00006pt]
&1&\mathbb{R}\\\\[1.00006pt]
&&1\end{pmatrix},\;\;\operatorname{\Theta}_{2}(\operatorname{X})=\begin{pmatrix}1&0&\mathbb{T}\\\\[1.00006pt]
&1&0\\\\[1.00006pt]
&&1\end{pmatrix}\cong\mathbb{T},\;\;\operatorname{\Theta}(\operatorname{X}_{1})=\mathbb{T}^{2}.$

We also check that
$\ker(h)=\begin{pmatrix}1&\mathbb{Z}&\mathbb{T}\\\\[1.00006pt]
&1&\mathbb{Z}\\\\[1.00006pt]
&&1\end{pmatrix}\;\cong\;\mathbb{Z}^{2}\times\mathbb{T}$. Note that the
structure groups of $\operatorname{X}$ are tori
($\operatorname{Z}_{2}=\mathbb{T}$, $\operatorname{Z}_{1}=\mathbb{T}^{2}$).
Thus $\operatorname{X}$ is also an example of the type of connected cfr
nilspace to which we turn next.

####  1 Toral nilspaces

Recall that a cfr abelian group $\operatorname{Z}$ has torsion-free dual group
if and only if $\operatorname{Z}\cong\mathbb{T}^{n}$ for some $n\geq 0$.

######  Definition 9.14.

We say that a $k$-step nilspace $\operatorname{X}$ is _torsion-free_ if every
structure group of $\operatorname{X}$ has torsion-free dual group. We call
$\operatorname{X}$ a _toral nilspace_ if it is cfr and torsion-free.

Thus a $k$-step compact nilspace is toral if and only if its structure groups
are all tori. One of the reasons for treating these nilspaces in particular is
that they occur naturally in the study of the regularizations of ultralimits
of functions on abelian groups, which can be used to prove inverse theorems
for the Gowers uniformity norms (see the characteristic-0 case of [39,
Definition 1.3]).

######  Lemma 9.15.

Every toral nilspace is connected.

###### Proof.

Recall the general fact that a fibre bundle is connected if the base space and
the fibre are connected (see [38, Part I, §2.12]). Thus if $\operatorname{Z}$
has finite rank and is connected then a continuous $\operatorname{Z}$-bundle
over a connected space is connected. Now given a $k$-step toral nilspace
$\operatorname{X}$, with factors $\operatorname{X}_{i}$, $i\in[k]$, a simple
induction on $i$ using this fact shows that $\operatorname{X}$ is connected. ∎

######  Remark 9.16.

The converse of Lemma 9.15 is false. Consider for example the connected 2-step
nilspace $\operatorname{X}$ consisting of the circle group $\mathbb{T}$ with
cube sets $\operatorname{C}^{n}(G_{\bullet})$ for the degree-2 filtration
$G_{\bullet}$ with $G_{0}=G_{1}=\mathbb{T}$ and
$G_{2}=\\{0,1/2\\}\cong\mathbb{Z}/2\mathbb{Z}$ (viewing $\mathbb{T}$ as
$[0,1)$ with addition mod 1). A straightforward calculation shows that
$x\sim_{1}y$ in $\operatorname{X}$ if and only if $x-y\in G_{2}$, whence the
structure group $\operatorname{Z}_{2}$ is the disconnected group $G_{2}$.

We can now establish the main result of this section.

######  Theorem 9.17.

Let $\operatorname{X}$ be a $k$-step toral nilspace, let
$G=\operatorname{\Theta}(\operatorname{X})^{0}$, let $G_{\bullet}$ denote the
degree-$k$ filtration
$(\operatorname{\Theta}_{i}(\operatorname{X})^{0})_{i\geq 0}$, and for an
arbitrary fixed $x\in\operatorname{X}$ let
$\Gamma=\operatorname{Stab}_{G}(x)$. Then $\operatorname{X}$ is isomorphic as
a compact nilspace to the nilmanifold $G/\Gamma$ with cube sets
$\operatorname{C}^{n}(\operatorname{X})=(\operatorname{C}^{n}(G_{\bullet})\cdot\Gamma^{\\{0,1\\}^{n}})/\Gamma^{\\{0,1\\}^{n}}$,
$n\geq 0$.

Note that for the nilmanifold obtained here, every group in the filtration
$G_{\bullet}$ is connected. (The fact that $G_{\bullet}$ here is indeed a
filtration follows from the fact that if $H_{1},H_{2}$ are closed subgroups of
a topological group and one of these subgroups is connected, then
$[H_{1},H_{2}]$ is connected.)

###### Proof.

We argue by induction on $k$. For $k=1$, by Lemma 1.4 we have that
$\operatorname{X}$ is the principal homogeneous space of a torus with cubes
being the projections of the standard cubes on the torus, so the statement
holds. Supposing then that the statement holds for $k-1$, we fix
$x\in\operatorname{X}$ and let $\Gamma=\operatorname{Stab}_{G}(x)$.

We first claim that $\Gamma$ is discrete. To see this, note that $h(\Gamma)$
is a subgroup of the stabilizer of $\pi_{k-1}(x)$ in
$\operatorname{\Theta}(\operatorname{X}_{k-1})$, so by induction it is
discrete. Then using that $h^{-1}(h(\Gamma))$ is a union of cosets of
$\ker(h)$, we have that it suffices to show that $\Gamma\cap\ker(h)$ is
discrete. But this follows from Lemma 9.9, since no non-trivial element of
$\tau(\operatorname{Z}_{k})$ stabilizes $x$.
By Corollary 9.12 the Lie group $\operatorname{\Theta}(\operatorname{X})^{0}$
acts transitively on the connected space $\operatorname{X}$, and it follows
that $\operatorname{X}$ is homeomorphic to the coset space $G/\Gamma$ (see
[23, Chapter II, Theorem 3.2]). Therefore $\Gamma$ is cocompact.

It now only remains to determine the cubes on $\operatorname{X}$. Recall from
[8, Definition 3.2.38] that two cubes
$\operatorname{c}_{1},\operatorname{c}_{2}\in\operatorname{C}^{n}(\operatorname{X})$
are said to be translation equivalent if there is an element
$\operatorname{c}\in\operatorname{C}^{n}(G_{\bullet})$ such that
$\operatorname{c}_{2}(v)=\operatorname{c}(v)\cdot\operatorname{c}_{1}(v)$. We
claim that for every cube
$\operatorname{c}\in\operatorname{C}^{n}(\operatorname{X})$ there is a cube
$\operatorname{c}^{\prime}\in\operatorname{C}^{n}(\operatorname{X})$ that is
translation equivalent to the constant $x$ cube and such that
$\pi_{k-1}\operatorname{\circ}\operatorname{c}=\pi_{k-1}\operatorname{\circ}\operatorname{c}^{\prime}$.
Indeed, given $\operatorname{c}\in\operatorname{C}^{n}(\operatorname{X})$, we
have
$\pi_{k-1}\operatorname{\circ}\operatorname{c}\in\operatorname{C}^{n}(\operatorname{X}_{k-1})$,
and by induction the latter cube is translation equivalent to the cube with
constant value $x^{\prime}=\pi_{k-1}(x)$, i.e. it is of the form
$\tilde{\operatorname{c}}\cdot x^{\prime}$ for some cube
$\tilde{\operatorname{c}}$ on the group
$\operatorname{\Theta}(\operatorname{X}_{k-1})^{0}$ with the filtration
$\big{(}\operatorname{\Theta}_{i}(\operatorname{X}_{k-1})^{0}\big{)}_{i\geq
0}$. Now by the unique factorization result for these cubes [8, Lemma 2.2.5],
we have
$\tilde{\operatorname{c}}={\tilde{g}_{0}}^{F_{0}}\cdots{\tilde{g}_{2^{n}-1}}^{F_{2^{n}-1}}$
where
$\tilde{g}_{j}\in\operatorname{\Theta}_{\operatorname{codim}(F_{j})}(\operatorname{X}_{k-1})^{0}$.
Theorem 9.10 (ii) then tells us that for each $j\in[0,2^{n})$ there is
$g_{j}\in\operatorname{\Theta}_{\operatorname{codim}(F_{j})}(\operatorname{X})^{0}$
such that $h(g_{j})=\tilde{g}_{j}$. Let $\operatorname{c}^{*}$ be the cube in
$\operatorname{C}^{n}(\operatorname{\Theta}(\operatorname{X})^{0})$ defined by
$\operatorname{c}^{*}={g_{0}}^{F_{0}}\cdots{g_{2^{n}-1}}^{F_{2^{n}-1}}$. Let
$\operatorname{c}^{\prime}=\operatorname{c}^{*}\cdot x$. This is in
$\operatorname{C}^{n}(\operatorname{X})$, and is translation equivalent to the
constant $x$ cube. Moreover, by construction we have

$\pi_{k-1}\operatorname{\circ}\operatorname{c}^{\prime}=\pi_{k-1}(\operatorname{c}^{*}\cdot
x)=\Big{(}\prod_{j}h(g_{j})^{F_{j}}\Big{)}\cdot
x^{\prime}=\Big{(}\prod_{j}\tilde{g}_{j}^{F_{j}}\Big{)}\cdot
x^{\prime}=\tilde{\operatorname{c}}\cdot
x^{\prime}=\pi_{k-1}\operatorname{\circ}\operatorname{c}.$

This proves our claim.

It follows from [8, Theorem 3.2.19] and the definition of degree-$k$ bundles
(in particular [8, (3.5)]) that
$\operatorname{c}-\operatorname{c}^{\prime}\in\operatorname{C}^{n}(\operatorname{\mathcal{D}}_{k}(\operatorname{Z}_{k}))$.
But then using translations from $\tau(\operatorname{Z}_{k})$ we can correct
$\operatorname{c}^{\prime}$ further to obtain $\operatorname{c}$, thus showing
that $\operatorname{c}$ is itself a translation cube with translations from
$\operatorname{\Theta}(\operatorname{X})^{0}$. (Such a correction procedure
has been used in previous arguments, see for instance the proof of [8, Lemma
3.2.25].)

We have thus shown that
$\operatorname{C}^{n}(\operatorname{X})\subset(\operatorname{C}^{n}(G_{\bullet})\cdot\Gamma^{\\{0,1\\}^{n}})/\Gamma^{\\{0,1\\}^{n}}$.
The opposite inclusion is clear, by definition of the groups
$\operatorname{\Theta}_{i}(\operatorname{X})$. ∎

######  Remark 9.18.

In Theorem 9.17 we can replace the groups $G_{i}$ by _simply connected_ Lie
groups $\tilde{G}_{i}$ while conserving the nilspace isomorphism with
$\operatorname{X}$. More precisely, let $\tilde{G}$ be the universal covering
group of the connected Lie group $G$, with covering homomorphism
$p:\tilde{G}\to G$ (see [35, §47, Theorem 61]). Let
$\tilde{\Gamma}=p^{-1}(\Gamma)$, and for each $i\geq 0$, let $\tilde{G}_{i}$
be the identity component of the closed (hence Lie) subgroup $p^{-1}(G_{i})$
of $\tilde{G}$. Then $\tilde{G}_{\bullet}=(\tilde{G}_{i})_{i\geq 0}$ is a
degree-$k$ filtration of closed connected (hence simply-connected [11,
Corollary 1.2.2]) Lie subgroups of $\tilde{G}$. It can be checked in a
straightforward way that $\tilde{G}/\tilde{\Gamma}$ with the cubes determined
by $\tilde{G}_{\bullet}$ is isomorphic to $\operatorname{X}$ as a compact
nilspace.

We know by a theorem of Palais and Stewart that $\operatorname{X}$ is the
total space of a principal torus bundle over a torus if and only if it is a
2-step nilmanifold (see [34, Theorem 1]). Theorem 9.17 can be viewed as a
generalization of this result for arbitrary step, in the category of compact
nilspaces (in particular, making use of the assumed cube structure).

One may wonder whether, by adding some simple assumption in Theorem 9.17, the
description of the filtered nilmanifold can then be made even more precise.
For instance, having seen Example 9.13, we may seek some simple additional
condition under which Theorem 9.17 yields the Heisenberg nilmanifold
$H/\Gamma$. In this direction we have the following result.

######  Proposition 9.19.

Let $\operatorname{X}$ be a 2-step toral nilspace of dimension 3. Then
$\operatorname{X}$ is isomorphic to one of the following compact nilspaces:

  1. (i)

The torus $\mathbb{R}^{3}/\mathbb{Z}^{3}$ with cube structure determined by a
filtration of degree at most 2 on $\mathbb{R}^{3}$.

  2. (ii)

The Heisenberg nilmanifold $H/\Gamma$ with cube structure determined by the
lower central series on $H$.

Here the dimension is that of $\operatorname{X}$ when viewed as a manifold (a
view which we noted after Lemma 5.3).

###### Proof.

Applying Theorem 9.17 and Remark 9.18, we have that $\operatorname{X}$ is
isomorphic as a compact nilspace to $G/\Gamma$ for a simply-connected Lie
group $G$ with a filtration $G_{\bullet}$ of degree at most 2 consisting of
closed (therefore Lie) simply-connected groups $G_{i}\leq G$, and a discrete
cocompact subgroup $\Gamma\leq G$. The assumption that $\operatorname{X}$ has
dimension 3 implies that $G$ is 3-dimensional.

If $\operatorname{X}$ is a 1-step nilspace then $\operatorname{X}$ is
isomorphic to the 3-torus $\mathbb{R}^{3}/\mathbb{Z}^{3}$ in case $(i)$, with
the standard degree-1 cube structure.

If $\operatorname{X}$ is not 1-step then, if $G$ is abelian, we have again
that $\operatorname{X}$ is isomorphic to $\mathbb{R}^{3}/\mathbb{Z}^{3}$ but
now the cube structure is given by a degree-2 filtration on $\mathbb{R}^{3}$
(for example it could be the filtration determining the degree-2 structure on
$\mathbb{R}^{3}/\mathbb{Z}^{3}$ defined in [8, Definition 2.2.30]). The
remaining possibility is that $G$ is non-abelian 2-step nilpotent. The simply-
connected Lie group $G$ is uniquely determined by its Lie algebra, which is a
real non-abelian, 2-step nilpotent Lie algebra of dimension 3. It follows from
the Bianchi classification [4] that the only such Lie algebra is the
3-dimensional Heisenberg Lie algebra, and so $G$ is the Heisenberg group.
Finally, we have that the only degree-2 filtration of closed connected
subgroups of $G$ is the lower central series. ∎

To close this section, we prove additional pleasant properties of toral
nilspaces. In particular, property $(iii)$ below gives a simple relation
between the translation groups and the structure groups.

######  Proposition 9.20.

Let $\operatorname{X}$ be a $k$-step toral nilspace. For each $j\in[k]$ let
$h_{j-1,j}$ denote the continuous surjective homomorphism
$\operatorname{\Theta}(\operatorname{X}_{j})^{0}\to\operatorname{\Theta}(\operatorname{X}_{j-1})^{0}$
defined as in Lemma 9.3, and for each $i\in[k]$ let
$h_{i}=h_{i,i+1}\operatorname{\circ}\cdots\operatorname{\circ}h_{k-1,k}:\operatorname{\Theta}(\operatorname{X})^{0}\to\operatorname{\Theta}(\operatorname{X}_{i})^{0}$.
Fix an arbitrary element $x\in\operatorname{X}$, and for each $i\in[k]$ let
$\Gamma_{i}=\operatorname{\Theta}_{i}(\operatorname{X})^{0}\cap\operatorname{Stab}_{\operatorname{\Theta}(\operatorname{X})^{0}}(x)$.
Then for each $i$, the following statements hold:

  1. (i)

$\operatorname{\Theta}_{i}(\operatorname{X})^{0}$ acts transitively on each
fibre of $\pi_{i-1}:\operatorname{X}\to\operatorname{X}_{i-1}$.

  2. (ii)

$\ker(h_{i})=\Gamma_{i}\cdot\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}$.

  3. (iii)

$\operatorname{\Theta}_{i}(\operatorname{X})^{0}\;/\;\big{(}\Gamma_{i}\cdot\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}\big{)}\;\cong\;\operatorname{Z}_{i}$.

###### Proof.

We prove $(i)$ by downward induction on $i$. For the case $i=k$, since each
fibre of $\pi_{k-1}$ is a homogeneous space of $\operatorname{Z}_{k}$, it
suffices to show that
$\operatorname{\Theta}_{k}(\operatorname{X})^{0}=\tau(\operatorname{Z}_{k})$.
This is immediate from the following equality, which actually holds for a
general nilspace and is established in [8, Lemma 3.2.37]:

$\operatorname{\Theta}_{k}(\operatorname{X})=\tau(\operatorname{Z}_{k}).$ (24)

Suppose now that $i\leq k-1$ and that the statement holds for $i+1$, and note
that any fibre of $\pi_{i-1}=\pi_{i-1,i}\operatorname{\circ}\pi_{i}$ has the
form $\pi_{i}^{-1}(\pi_{i-1,i}^{-1}(y))$ for some
$y\in\operatorname{X}_{i-1}$. Given $w,w^{\prime}$ in such a fibre, we have
$\pi_{i}(w),\pi_{i}(w^{\prime})\in\pi_{i-1,i}^{-1}(y)$. Since
$h_{i}(\operatorname{\Theta}_{i}(\operatorname{X})^{0})=\operatorname{\Theta}_{i}(\operatorname{X}_{i})^{0}=\tau(\operatorname{Z}_{i})$,
we have that this acts transitively on $\pi_{i-1,i}^{-1}(y)$ and so there is
$\alpha\in\operatorname{\Theta}_{i}(\operatorname{X})^{0}$ such that
$\pi_{i}(\alpha(w))=\pi_{i}(w^{\prime})$. Then, since
$\operatorname{\Theta}_{i}(\operatorname{X})^{0}$ contains
$\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}$, by induction it acts
transitively on each $\pi_{i}$-fibre and so there exists
$\alpha^{\prime}\in\operatorname{\Theta}_{i}(\operatorname{X})^{0}$ such that
$\alpha^{\prime}\alpha(w)=w^{\prime}$. This proves statement $(i)$.
To see statement $(ii)$, note that
$\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}\leq\ker(h_{i})$, since
$h_{i}$ sends $\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}$ into the
trivial group $\operatorname{\Theta}_{i+1}(\operatorname{X}_{i})^{0}$. We also
have that $\Gamma_{i}\subset\ker(h_{i})$, because by (24) we have
$h_{i}(\Gamma_{i})\subset\tau(\operatorname{Z}_{i})$ but also each element of
$h_{i}(\Gamma_{i})$ fixes $\pi_{i}(x)$, so must be the trivial translation in
$\tau(\operatorname{Z}_{i})$. It follows that
$\Gamma_{i}\cdot\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}\subset\ker(h_{i})$.
To see the opposite inclusion, note that for $\alpha\in\ker(h_{i})$ we have
from the definitions that
$\pi_{i}(\alpha(x))=h_{i}(\alpha)(\pi_{i}(x))=\pi_{i}(x)$. Therefore, by
statement $(i)$ there exists
$\alpha^{\prime}\in\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}$ such
that $\alpha^{\prime}\alpha(x)=x$, so $\alpha^{\prime}\alpha\in\Gamma_{i}$,
and so
$\alpha\in\operatorname{\Theta}_{i+1}(\operatorname{X})^{0}\cdot\Gamma_{i}$.
Statement $(iii)$ now follows from $(ii)$, the first isomorphism theorem for
$h_{i}$, and (24) for $k=i$. ∎

## References

  * [1] A. Adem, J. F. Davis, _Topics in transformation groups_ , Handbook of geometric topology, 1–54, North-Holland, Amsterdam, 2002.
  * [2] R. D. Anderson, _Hilbert space is homeomorphic to the countable infinite product of lines_ , Bull. Amer. Math. Soc. 72 (1966), 515–519.
  * [3] H. Becker, A. S. Kechris, _The descriptive theory of polish group actions_ , London Mathematical Society Lecture Note Series, 232. Cambridge University Press, Cambridge, 1996.
  * [4] L. Bianchi, _On the three-dimensional spaces which admit a continuous group of motions_ , Gen. Relativity Gravitation 33 (2001), no. 12, 2171–2253.
  * [5] P. Billingsley, _Convergence of probability measures_ , Second edition. John Wiley & Sons, Inc., New York, 1999.
  * [6] N. Bourbaki, _Elements of mathematics. General topology. Part 1_ , Hermann, Paris; Addison-Wesley Publishing Co., Reading, Mass.-London-Don Mills, Ont. 1966.
  * [7] N. Bourbaki, _Integration. I. Chapters 1–6_ , translated from the 1959, 1965 and 1967 French originals by Sterling K. Berberian. Elements of Mathematics (Berlin). Springer-Verlag, Berlin, 2004.
  * [8] P. Candela, _Notes on nilspaces: algebraic aspects_ , Discrete Analysis, 2017, Paper No. 15, 59 pp.
  * [9] O. A. Camarena, B. Szegedy, _Nilspaces, nilmanifolds and their morphisms_ , preprint. http://arxiv.org/abs/1009.3825arXiv:1009.3825.
  * [10] A. Censor, D. Grandini, _Borel and continuous systems of measures_ , Rocky Mountain J. Math. 44 (2014), no. 4, 1073–1110.
  * [11] L. Corwin, F. P. Greenleaf, _Representations of nilpotent Lie groups and their applications, Part 1: Basic theory and examples_ , Cambridge studies in advanced mathematics 18, C.U.P. 1990.
  * [12] A. Deitmar, S. Echterhoff, _Principles of harmonic analysis_ , Universitext. Springer, New York, 2009.