Notes on compact nilspaces

These notes form the second part of a detailed account of the theory of nilspaces developed by Camarena and Szegedy. Here we focus on nilspaces equipped with a compact topology that is compatible with the cube structure, called compact nilspaces. The material in these notes relies on the first part of our exposition (available as arXiv:1601.03693), and it expands on the third chapter of the paper of Camarena and Szegedy, providing more detailed proofs of their results. To that end we also include several additional results that are implicit in their paper.


Introduction
These notes form the second part of a detailed account of the theory of nilspaces developed by Camarena and Szegedy in the paper [8]. The material in these notes expands on the third chapter of their paper, providing more detailed proofs of the main results. To that end we also include several additional results that are implicit in [8]. This material relies strongly on the first part of our exposition, given in [7].
We shall have to assume some familiarity with the basic theory of nilspaces and some of their algebraic properties, but we shall always refer to the relevant results in [7].
Recall the notion of a nilspace from [7,Definition 1.5]. The principal objects treated in these notes are compact nilspaces. These are nilspaces equipped with a compact topology that is compatible with the cube structure. To give the precise definition, we adopt the following terminology. Definition 1.1. Throughout the sequel, to be concise we shall use the term compact space to mean a compact, Hausdorff, second-countable topological space.
In particular, compact spaces in these notes are Polish spaces [23,Theorem 5.3]. More generally, topological spaces will usually be assumed to be Hausdorff and second-countable.
Recall from [7,Definition 1.7] the notion of a cubespace. Definition 1.2. A cubespace X is called a compact cubespace if X is a compact space and C n (X) is a closed subset of X {0,1} n for every n ∈ N. A compact nilspace is a compact cubespace satisfying the ergodicity and corner-completion axioms from [7,Definition 1.5].
The main goal in the sequel is to characterize compact nilspaces.
A central result in this direction is a description of a general compact nilspace as an inverse limit of simpler spaces, namely compact nilspaces of finite rank (these are defined in Section 2.5). This result is treated in Section 2.7 (see Theorem 2.72).
Another central result concerns finite-rank compact nilspaces, and involves nilmanifolds, i.e. compact homogeneous spaces of nilpotent Lie groups, the study of which goes back to [26]. To situate the result, let us note that nilmanifolds provide central examples of compact nilspaces. Indeed, a nilmanifold becomes a compact nilspace when, given a filtration with certain topological properties on the Lie group, the nilmanifold is equipped with the natural cubes associated with the filtration, namely the cubes introduced by Host and Kra [20,21]. This construction is treated from a purely algebraic viewpoint in [7,Section 2.3], and its basic topological aspects are detailed in Section 1.1 below. The central result in question here goes in the converse direction, and states that if a compact nilspace of finite rank has connected structure groups, 1 then it is isomorphic to a nilmanifold with a cube structure of the kind mentioned above. This is treated in Section 2.9 (see Theorem 2.96).
This cocompactness is proved elsewhere in the literature but we include a proof here for completeness, following the argument from [14,Lemma E.10]. By Definition 1.3 there is a compact set K j ⊆ G j such that the product set K j Γ j equals G j . Recall from [7,Lemma 2.10] that every cube c ∈ C n (G • ) has a unique factorization c = g F0 0 g F1 1 · · · g Let H 0 = C n (G • ) and for each i ∈ [2 n ] let H i = {c ∈ C n (G • ) : g 0 = · · · = g i−1 = id G }. It follows from (1.1) that c ∈ H i if and only if c(v j ) = id G for all j < i. We deduce that H i is a normal subgroup of C n (G • ). We shall now use these subgroups to show that every c ∈ C n (G • ) is a product of an element of C n (G • ) ∩ Γ {0,1} n with an element of K := {k F0 0 . . . k F 2 n −1 2 n −1 : k i ∈ K i }. This will prove the claimed sufficiency, since the set K is compact. Let i ∈ [2 n ] and suppose that c ∈ H i−1 . Then c = g Fi i c , where c ∈ H i . We then have g Fi i = (k i γ i ) Fi where k i ∈ K codim(Fi) and γ i ∈ Γ codim(Fi) . Since H i is normal, we have c = k Fi i c γ Fi i with c ∈ H i . Starting with any cube in H 0 and repeating this procedure, we eventually obtain the desired factorization showing that c ∈ K · C n (G • ) ∩ Γ {0,1} n .
To see the necessity of each set G i /Γ i being compact, let Q i denote the set of cubes c ∈ C i (X) such that c(v) is the trivial coset Γ for all v = 0 i . Since C i (X) is compact, so is Q i . We have c = π Γ • c for some c ∈ C i (G • ) with c (v) ∈ Γ for v = 0 i . The fact that c ∈ C i (G • ) implies that the Gray-code product σ i (c ) lies in G i (recall [7, Definition 2.27 and Proposition 2.30]). By the formula for the Gray-code product, we deduce that σ i (c ) c (0 i ) −1 ∈ Γ. It follows that c (0 i ) ∈ G i Γ. Thus the projection π 0 i : c → c(0 i ) maps Q i into (G i Γ)/Γ. Conversely, for every coset gΓ with g ∈ G i there is a cube c ∈ Q i with π 0 i (c) = gΓ, namely c = π Γ • c where c (0 i ) = g and c (v) = id G otherwise. It follows that π 0 i (Q i ) = (G i Γ)/Γ, so the compactness of Q i implies that (G i Γ)/Γ is compact, and so is therefore G i /Γ i .

Chapter 2
Characterization of compact nilspaces 2

.1 Topological preliminaries
In order to characterize a general compact nilspace, we first have to examine how the basic algebraic structures treated in [7] behave under the additional topological assumptions in Definition 1.2.
We begin with a result showing that the closure condition on C n (X) needs to be checked only for n = k+1.
Lemma 2.1. A k-step nilspace X is a compact nilspace if and only if X is a compact space and C k+1 (X) is a closed subset of X {0,1} k+1 .
Proof. Note that for all n ≤ m we can view C n (X) as the projection of C m (X) to X {0,1} n (by the composition axiom, embedding {0, 1} n as a face in {0, 1} m ). In particular, if we assume that C k+1 (X) is closed then for every n < k + 1 the projection C n (X) is also closed. If n > k + 1, then for any (k + 1)-dimensional face F let where f • φ F is the restriction of f to F (recall [7,Definition 1.4]). Thus Q F is the preimage of a closed set under the restriction map f → f • φ F , and is therefore closed. Then, by [7,Lemma 3.32], we have C n (X) = F Q F where F runs through (k + 1)-dimensional faces of {0, 1} n .
In the remainder of this section we establish topological properties of the structures in [7,Chapter 3] under the compactness assumption. The main result that we shall obtain along these lines is that if a finite-step nilspace is compact, then the associated abelian bundle obtained in [7,Theorem 3.38] is endowed with a topological structure making it an iterated continuous abelian bundle (in a sense that we shall formalize in Definition 2.6), with structure groups being compact abelian groups.
We begin by looking at the behaviour of some basic constructions. Recall from [7,Definitions 3.15 and 3.17] the notions of arrow spaces and the spaces ∂ x X.
Lemma 2.2. Let X be a compact nilspace, let Z be a compact abelian group, and fix any x ∈ X. Then the arrow spaces X i X, i ≥ 1, the nilspaces D k (Z), k ≥ 1, and the space ∂ x X, are all compact nilspaces.
Proof. The space X × X underlying X i X is compact and C k+1 (X i X) is the image under a continuous map of a closed set of cubes in C k+1+i (X) (see [7, (3.4)]), so it is a compact set as required. The cube set C k+1 (D k (Z)) is also compact, since it is the set of solutions of a linear equation (recall [7, (2.9)]).

Continuous abelian bundles
Recall from [7,Definition 3.36] the notion of an abelian bundle and of a k-fold abelian bundle.
Definition 2.6. Let B be an abelian bundle with base S, structure group Z and projection π. We say that B is continuous if the following conditions hold: (i) B and S are topological spaces.
(ii) Z is an abelian topological group.
(iii) The action α : Z × B → B is continuous. We say that B is a compact abelian bundle if, in addition to these conditions, B, S, Z are compact spaces.
Remark 2.7. Recall that by [7,Definition 3.36] the projection π yields a bijection between S and the orbits of α, namely the bijection s → π −1 (s). It follows that we obtain a definition equivalent to Definition 2.6 if we replace condition (iv) with the following: (iv') Denoting by B /α the set of Z-orbits equipped with the quotient topology, we have that the map S → B /α, s → π −1 (s) is a homeomorphism.
Thus the base S is topologically identified with the orbit space for the Z-action on B. In particular, since the orbit map B → B /α, x → x + Z is an open map, we have that the projection π is an open map. Note also that if Z is compact, then the orbit map is also a closed map, and hence so is π.
Definition 2.8. Let X = B k be a k-fold abelian bundle, with factors B i , i = 0, . . . , k. We say that X is a k-fold compact abelian bundle if for each i ∈ [k] the factor B i is a compact Z i -bundle with base B i−1 . A compact degree-k bundle is a k-fold compact abelian bundle that is also a compact cubespace with respect to the same topology, and such that condition (3.5) from [7,Definition 3.37] is satisfied, that is, for every i ∈ [0, k − 1] and every n ∈ N, we have C n (B i ) = {π i • c : c ∈ C n (X)}, and for every c ∈ C n (B i+1 ) we have {c 2 ∈ C n (B i+1 ) : π i • c = π i • c 2 } = {c + c 3 : c 3 ∈ C n (D i+1 (Z i+1 ))}. (2.1) We can now establish the main result of this subsection.
Proposition 2.9. A compact cubespace X is a compact degree-k bundle if and only if X is a k-step compact nilspace.
Proof. The algebraic part of the statement is given by [7,Theorem 3.38], so we only need to check the topological properties in each direction.
If X is a compact degree-k bundle then in particular it is a compact cubespace satisfying the nilspace axioms, so it is a k-step compact nilspace. Conversely, if X is a k-step compact nilspace then, to show that the degree-k bundle structure given by [7,Theorem 3.38] is compact, it suffices to show that the abelian structure group Z k can be equipped with a topology making it a compact abelian group such that X is a compact Z k -bundle with base F k−1 (X) (if we show this then the result follows by repeating the argument for Z k−1 and so on by induction). For this it suffices to show that Z k can be equipped notes on compact nilspaces with a compact topology such that the action of Z k on X is continuous (since Lemma 2.5 then implies the remaining condition (iv') in Definition 2.6). Let F be a class of ∼ k−1 in X. From the proof of [7,Corollary 3.35] we know that F together with the F -valued cubes in each C n (X) is a k-fold ergodic k-step nilspace. Using [7,Lemma 3.24] we deduce that F is closed and it follows that F is a compact nilspace. Then by Lemma 2.4 there is a compact topology on Z k such that F is isomorphic to D k (Z k ) as a compact nilspace. We now check that the action of Z k is continuous on F by showing that its graph {(a, y 0 , y 0 + a) : a ∈ Z, y 0 ∈ X} is closed in Z k × X 2 . This graph can be described using the arrow space Y = X 1 X. Indeed, recall from [7,Lemma 3.34] that for x = (x 0 , x 1 ), y = (y 0 , y 1 ) in F 2 ⊂ Y we have x ∼ k−1 y if and only if x 0 − x 1 = y 0 − y 1 in Z k . It follows that, fixing some e ∈ F , the graph above is homeomorphic to the closed set {(x, y) ∈ F 2 × F 2 : x ∼ k−1 y, x 0 = e}. We have thus shown that from any given fibre F the group Z k acquires a compatible compact topology making its action on F continuous. To see that this topology is the same for every fibre, recall that by [7,Lemma 3.43] for any two fibres F 0 , F 1 and fixed points x i ∈ F i , we have an isomorphism ϑ : Z F0 → Z F1 , defined by ϑ(a) = b if and only if (x 0 , x 1 ) ∼ k−1 (x 0 + a, x 1 + b). We then see that ϑ is continuous by identifying its graph with the closed set {y ∈ F 0 × F 1 : y ∼ k−1 (x 0 , x 1 )}. It follows that ϑ is a homeomorphism.
Recall the notions of a bundle morphism [ Recall also that in the purely algebraic setting we had a description of a set of restricted morphisms hom f (P, X) as a sub-bundle of X P , namely [7,Lemma 3.66]. This has the following version for compact nilspaces.
Lemma 2.10. Let P be a subcubespace of {0, 1} n with the extension property, let S be a subcubespace of P with the extension property in P , let X be a k-step compact nilspace and let f : S → X be a morphism. Then hom f (P, X) is a compact k-fold abelian bundle that is a sub-bundle of X P , with factors hom πi • f (P, X i ) and structure groups hom S→0 (P, D i (Z i )), where Z i is the i-th structure group of X.
Proof. We just have to check the topological properties. The set hom f (P, X) is closed in X P and therefore compact. For each i ∈ [k] the abelian group hom S→0 (P, D i (Z i )) is also compact, as a closed subgroup of Z P i , and the action of hom S→0 (P, D i (Z i )) inherits continuity from that of Z i . Condition (iv) from Definition 2.6 is also inherited from X P since the topology on each factor hom πi • f (P, X i ) is the subspace topology from X P i .

Metrics
By Remark 2.3 (ii), we know that a compact nilspace can always be equipped with a compatible metric.
We shall often use the fact that this metric can be assumed to be invariant under the action of the last structure group. We record this fact as follows.
p. candela Lemma 2.11. Let X be a k-step compact nilspace and let d 0 be a metric on X generating its topology.
Define d(x, y) = z∈Z k d 0 (x + z, y + z) dµ Z k (z), for any x, y ∈ X. Then d is a Z k -invariant metric that generates the same topology on X.
This invariant metric is a basic construction in the theory of G-spaces (see [28,Proposition 1.1.12]).
Proof. It is clear that d is a Z k -invariant metric. To see that d generates the same topology as d 0 , note first that the function X × X → R ≥0 , (x, y) → d(x, y) is continuous and in particular for a fixed x ∈ X we have that y → d(x, y) is continuous (relative to d 0 ). It follows that the topology generated by d is a subtopology of the given topology on X. In particular the former topology is compact. However, that topology is also Hausdorff, so it is maximal among the compact topologies on X, and so it must be the original topology on X (see [5,§9.4,Corollary 3]).
From now on we always assume that a metric on X is Z k -invariant in this sense. Given such a metric d on X, we may define the following quotient metric on F k−1 (X) (see [28,Proposition 1.1.12]): In the sequel we shall use the following fact several times.
Lemma 2.12. Let X be a k-step compact nilspace, and let Cor k+1 (X) denote the set of (k + 1)-corners on X with the subspace topology obtained from the product topology on X {0,1} k+1 \{1 k+1 } . Let K : Cor k+1 (X) → X denote the map sending a (k + 1)-corner c to c(1 k+1 ), where c is the unique completion of c . Then K is continuous.
Proof. We argue by contradiction. If K were not continuous then there would exist some corner c , some open set U K(c ) and a sequence of corners c n converging to c such that for all n we have K(c n ) ∈ U . Let c n denote the completion in C k+1 (X) of c n . By the compactness of C k+1 (X) there exists a subsequence (c m ) of (c n ) such that c m converges to some cube c ∈ C k+1 (X). This convergence combined with the assumption that c n → c implies that for each v = 1 k+1 we have c(v) = c (v), so by uniqueness of completion we have c(1 k+1 ) = K(c ) ∈ U . On the other hand, the convergence c m → c also implies that c m (1 k+1 ) → c(1 k+1 ). Since by assumption c m (1 k+1 ) = K(c m ) ∈ U for all m, we have Let us record also the following consequence of Lemma 2.12, to the effect that proximate cubes on F k−1 (X) can always be lifted to proximate cubes on X.
Lemma 2.13. Let X be a k-step compact nilspace and let d, d be the metrics on X, F k−1 (X) given by Lemma 2.11 and (2.2) respectively. Then for every > 0 there exists δ > 0 such that the following holds.

Measure-theoretic preliminaries
In this section we collect the main tools from measure theory that we shall use in the sequel.
A notion that unifies most of these tools is that of a continuous system of measures, discussed in Subsection 2.2.1.
Using continuous systems of measures, we shall then define in Subsection 2.2.2 an invariant measure on a continuous abelian bundle, and use this to construct a generalization of the Haar measure for compact nilspaces.
In Subsection 2.2.3 we collect several constructions of probability spaces that will be used repeatedly later in the chapter.

Continuous systems of measures
Recall that a measure µ on a measure space X is said to be concentrated on S ⊂ X if µ(X \ S) = 0.
The study of continuous systems of measures goes back at least to Bourbaki (see [6, Ch. V, §3]). A recent treatment is given in [9]. We shall use the following definition.
Definition 2.14. Let X, Y be compact spaces and let π : X → Y be continuous. A continuous system of measures (CSM) on the map π is a family of Borel measures {µ y : y ∈ Y } on X satisfying the following conditions: (i) For every y ∈ Y the measure µ y is concentrated on π −1 (y).
(ii) For every continuous function f : X → C, the function Y → C, y → π −1 (y) f dµ y is continuous.
As explained in [9], replacing C by R in condition (ii) yields an equivalent definition.
Note that all the CSMs that we shall consider in these notes consist of strictly positive measures µ y , i.e.
Borel measures taking positive values on non-empty open sets.
A simple example of a CSM is obtained by taking a product space, as follows.
Lemma 2.15. Let V and Y be compact spaces, let µ be a Borel probability measure on V , let X = V × Y and let π : X → Y, (v, y) → y. For each y ∈ Y let µ y denote the measure on X concentrated on π −1 (y), where it equals the pushforward of µ under the map V → π −1 (y), v → (v, y). Then {µ y : y ∈ Y } is a CSM on π.
Proof. Let f : V × Y → R be a continuous function. Then f is a uniform limit of functions of the form (The fact that this algebra separates points follows from Urysohn's lemma [27,Theorem 33.1].) Now, for a function f i,1 (v)f i,2 (y) as above, it is clear that integrating over v yields a continuous function of y. It follows that y → π −1 (y) f dµ y is a uniform limit of continuous functions and is therefore continuous.
One of our main uses of CSMs below is to equip any compact abelian bundle with a probability measure that is invariant under the action of the structure group. This measure will be obtained as a simple application of the following result concerning general CSMs. Lemma 2.16. Let {µ y : y ∈ Y } be a family of Borel probability measures on X forming a CSM on π : X → Y , and let ν be a Borel probability measure on Y . Then the following function on Borel sets E ⊂ X is a Borel probability measure: Proof. This is a special case of [9, Corollary 3.7], using [9, Proposition 2.23].

Haar measure on compact abelian bundles and nilspaces
Recall that every compact abelian group can be equipped with a regular Borel probability measure that is invariant under translation, called the (normalized) Haar measure [31]. In this subsection we shall construct a generalization of this measure for compact nilspaces. As we shall see, there is a natural inductive construction of a probability measure on a k-fold compact abelian bundle, starting with the Haar measure on a compact abelian group. This construction will yield the desired measure on a k-step compact nilspace, thanks to [7,Theorem 3.38].
Our first step, then, is to define a Haar measure on a compact abelian bundle.
Lemma 2.17. Let B be a compact abelian bundle with base S, structure group Z and projection π. Let µ S be a regular Borel probability measure on S. Then there is a unique regular Borel probability measure µ on B that is invariant under the action of Z and satisfies µ S = µ • π −1 .
We call µ the Haar measure on B (given µ S ).
Proof. For each s ∈ S the set π −1 (s) is a principal homogeneous space of Z, so there is a Z-equivariant homeomorphism f : Z → π −1 (s). Let µ s be the pushfoward measure µ Z • f −1 on π −1 (s), where µ Z is the Haar measure on Z. If we show that {µ s : s ∈ S} is a CSM on π, then by Lemma 2.16 we can define a Borel measure µ on B by the following formula: for every Borel set E ⊂ B.
To show that {µ s : s ∈ S} is a CSM on π we check condition (ii) from Definition 2.14. Given any continuous function f : B → R, we need to show that g : S → R, s → π −1 (s) f dµ s is continuous. Since S has the quotient topology (Definition 2.6), it suffices to show that g • π : B → R is continuous. Now is continuous. Therefore, the continuity of g • π follows from (the proof of) Lemma 2.15 applied with We thus obtain the Borel measure µ given by (2.3), and µ is regular by the standard fact that any In particular, for every k-step compact nilspace X, applying the proposition to the bundle structure we obtain the measure that we shall call the Haar measure on X.
Proof. By induction on i ∈ [k], starting with the Haar probability on Z 1 and applying Lemma 2.17 for i = 2, . . . , k.
Recall from [7,Definition 3.56] that a bundle morphism φ : B → B between k-fold abelian bundles is said to be totally surjective if the structure morphism α i : The following basic result is the analogue for nilspaces of the fact that continuous surjective homomorphisms between compact abelian groups preserve the Haar measures.
Proof. We argue by induction on k. The case k = 1 follows from the fact recalled above. For k > 1, recall that by [7,Definition 3.56] the map φ induces a totally surjective continuous bundle morphism π k−1 : B → B k−1 respectively (as in the proof of Lemma 2.17). For s ∈ B k−1 and any Borel set The restriction of φ to a fibre π −1 k−1 (s), being a continuous affine homomorphism onto some fibre π −1 k−1 (s ), preserves the measures µ s , µ s . Hence we have f B (s) = f B (φ k−1 (s)) for each s ∈ B k−1 . Since φ k−1 is measure-preserving (by the induction hypothesis), we have Recall from [7, Definition 3.62] the notion of a fibre-surjective morphism. In the sequel we shall have to use CSMs on certain maps from cube sets C n (X) to X, such as the evaluation map c → c(0 n ). These CSMs will be obtained as special cases of the construction in the next lemma.
Recall from [7, Definition 3.36] the notion of a relative k-fold abelian bundle. We may similarly define a compact relative k-fold abelian bundle B with ground set B 0 . Note that each fibre of the projection π 0 : B → B 0 is then itself a compact k-fold abelian bundle and so it has a Haar measure by Lemma 2.17. To prove this we shall have to compose several CSMs, in the following sense.
Definition 2.22. Given CSMs {µ y : y ∈ Y } on π : X → Y and {µ z : z ∈ Z} on τ : Y → Z, their composition is the CSM {ν z : z ∈ Z} on τ • π : X → Z consisting of measures defined for Borel sets E ⊂ X by The fact that this composition is indeed a CSM is established in [9,Proposition 3.3]. The following result is an analogue for compact abelian bundles of the quotient integral formula.
Lemma 2.23. Let B, B be compact k-fold abelian bundles, with Haar measures µ, µ respectively, and let φ : B → B be a totally surjective continuous bundle morphism. For each t ∈ B let µ t denote the Haar measure on φ −1 (t). Then the measures µ t , t ∈ B disintegrate µ relative to µ , that is for every Borel set Recall from [7, Definition 3.59] the notion of the kernel of a bundle morphism.
Proof. The kernel of φ is a compact relative k-fold abelian bundle, with ground set B , and the fibres φ −1 (t) are compact k-fold abelian bundles (recall [7, Lemma 3.61]). By Lemma 2.21 the Haar measures µ t form a CSM on φ. By Lemma 2.16, with this CSM and µ we can define a Borel probability ν on B by We have to show that ν = µ. For this it suffices to show that ν has the invariance properties that characterize the Haar measure µ, namely that for each projection π i : B → B i the measure ν • π −1 i on B i is Z i -invariant (recall Proposition 2.18). We prove this by induction on k. show that ν • π −1 k is of the same form as ν (as in (2.5)), but relative to the totally surjective morphism φ k : B k → B k induced by φ : B k+1 → B k+1 . By construction, the Haar measure µ has a disintegration relative to the Haar measure µ k on B k , into measures µ s , s ∈ B k , each of which is the Haar measure on Z k+1 pushed forward to the fibre π k −1 (s). Thus for any Borel set E ⊂ B k we have For each s ∈ B k and each t ∈ B with π k (t) = s, note that φ −1 (t) is a (k + 1)-fold compact abelian bundle, with k-th factor φ −1 k (s) having Haar measure denoted µ s . Then π k restricted to φ −1 (t) pushes µ t forward to µ s . It follows that for any such s, t we have The right side here is indeed the measure on B k constructed in the same way as ν in (2.5). Therefore, as mentioned above, by induction it now suffices to show that ν is Z k+1 -invariant.
Again we use the disintegration of µ relative to µ k−1 , so that for any Borel set E ⊂ B we have For each s ∈ B k , we claim that the inner integral on the right side here integrates 1 E over a union of , and by disintegrating µ t into the fibres of π k : φ −1 (t) → φ −1 k (s), the inner integral in question is written By Fubini's theorem we can interchange the two outer integrals, so this equals For each y ∈ φ −1 k (s), note that π k −1 (s) is a Z k+1 -torsor (or principal homogeneous space of Z k+1 ) and for every t in this torsor we have that π −1 k (y) ∩ φ −1 (t) is a ker(α k+1 )-torsor, where α k+1 is the (k + 1)-th structure morphism of φ (recall [7, Definition 3.56 and Lemma 3.61]). Fixing any t 0 in the former torsor, and then for each r ∈ Z k+1 fixing some x r ∈ π −1 k (y) ∩ φ −1 (t 0 + r), the last inner double-integral equals Note that the sets {x r + u : u ∈ ker(α k+1 )}, r ∈ Z k+1 form a partition of π −1 k (y). It follows from the quotient integral formula [10, Theorem 1.5.2] that for any x 0 ∈ π −1 k (y) this integral equals This is clearly invariant under shifting E by any fixed z ∈ Z k+1 . The Z k+1 -invariance of ν follows.
Recall the fact that the Haar measure on a compact abelian group is strictly positive. This generalizes to compact nilspaces.   By regularity of µ there is a compact subset C ⊂ B such that µ (C) > 0, and then since π k−1 preserves Haar measures we have µ(π −1 k−1 (C)) > 0. Now by Remark 2.7 we also have that π k−1 is a proper map, so π −1 k−1 (C) is a compact set. This set is covered by the union of open sets z∈Z k U + z, so there is a finite set of translates of U by elements of Z k that covers π −1 k−1 (C), and it follows that µ(U ) > 0.

Probability spaces of morphisms
Recall from [7, Definition 3.3] that given a cubespace P and a subcubespace S of P , we say that S has the extension property in P if for every non-empty nilspace X and every morphism g : S → X there is a morphism g : P → X with g| S = g .
In this subsection we collect several constructions of probability spaces of morphisms between nilspaces, which will be used repeatedly in the sequel. These constructions rely on two basic ideas.
Firstly, every set of restricted morphisms hom f (P, X) has a compact abelian-bundle structure, as described in Lemma 2.10, which we restate here for convenience.
Lemma 2.25. Let P be a subcubespace of {0, 1} n with the extension property, let S be a subcubespace of P with the extension property in P , let X be a k-step compact nilspace and let f : S → X be a morphism. Then hom f (P, X) is a compact k-fold abelian bundle that is a sub-bundle of X P , with factors hom πi • f (P, X i ) and structure groups hom S→0 (P, D i (Z i )), where Z i is the i-th structure group of X.
As a consequence of this structure we have a Haar measure on hom f (P, X), by Proposition 2.18.
The second idea consists in giving a simple description of the measure-theoretic properties of a restriction map from one set of such morphisms to another. In particular, we want a convenient criterion to decide whether, for a subcubespace S of P , the restriction map hom(P, X) → hom(S, X) preserves the Haar measures. The following notion provides a general criterion of this type.
Definition 2.26. Let P be a cubespace, and let P 1 , P 2 be subcubespaces of P . We call the pair of sets P 1 , P 2 a good pair if P 1 and P 1 ∩ P 2 both have the extension property in P and, for every abelian group Z and every k ∈ N, every morphism f : P 2 → D k (Z) satisfying f | P1∩P2 = 0 extends to a morphism Note that in particular if S has the extension property in P ⊂ {0, 1} n and P 1 = ∅ then P 1 , S is a good pair in P . The main purpose of this definition is the following result.
Lemma 2.27. Let P ⊂ {0, 1} n be a subcubespace with the extension property, and let P 1 , P 2 be a good pair in P . Let X be a k-step nilspace and let f : P 1 → X be a morphism. Then the restriction map is a totally-surjective bundle morphism. In particular, if X is a k-step compact nilspace, then φ preserves the Haar measures. Moreover, the Haar measures on the fibres φ −1 (t) form a CSM on φ that disintegrates the Haar measure on hom f (P, X) relative to the Haar measure on hom f | P 1 ∩P 2 (P 2 , X).
Proof. We prove that φ is a totally-surjective bundle morphism by induction on k. For k = 0 the claim holds trivially, so let k ≥ 1 and suppose that X is a k-step nilspace and that the lemma holds for (k − 1)step nilspaces. To see that condition (i) from [7, Definition 3.56] holds, note that by a straightforward calculation we have that φ induces a map φ k−1 : well-defined by π k−1 • g → π k−1 • φ(g), so the condition holds for i = k − 1. We also have that φ k−1 is precisely the restriction map on hom π k−1 • f (P, X k−1 ), so by induction the condition holds for all i ≤ k − 1. Condition (ii) from the same definition is clearly satisfied, with the structure morphism α i being the restriction hom P1→0 (P, D i (Z i )) → hom P1∩P2→0 (P 2 , D i (Z i )). To check that φ is totally Another useful feature of good pairs is the following extension result for morphisms.
Lemma 2.28. Let P be a subcubespace of {0, 1} n with the extension property, and let P 1 , P 2 be a good pair in P . Then P 1 ∪ P 2 equipped with the union of the cube structures on P 1 , P 2 has the following extension property: any morphism f : P 1 ∪ P 2 → X into a non-empty k-step nilspace X extends to a morphism f : P → X.
Proof. We argue again by induction on k. The statement is trivial for k = 0, as X is then a 1-point space, so suppose that the lemma holds for (k − 1)-step nilspaces and let X be a k-step nilspace. Let f : P 1 ∪ P 2 → X be a morphism and let f 2 : P → F k−1 (X) be an extension of π k−1 • f . By [7, Lemma there is an extension For the remainder of this section we apply the results above to define various probability spaces of morphisms. We begin with the cube sets C n (X) on a compact nilspace. Note that C n (X) = hom({0, 1} n , X) is a compact k-fold abelian bundle and therefore has a Haar measure (by Proposition 2.18).
Lemma 2.29. Let X, Y be k-step compact nilspaces and let n ∈ N. Then for every continuous fibre- We shall often want to use a disintegration of the Haar measure on C n (X) into a CSM on the projection c → c(0 n ). For this purpose we record the following special case of Lemma 2.27.
Lemma 2.30. Let X be a k-step compact nilspace with Haar measure µ, let π : C n (X) → X, c → c(0 n ), and let µ n denote the Haar measure on C n (X). Then for every x ∈ X, the space π −1 (x) = C n x (X) is a compact k-fold abelian bundle and therefore has a Haar measure µ x . The family {µ x : x ∈ X} is a CSM on π disintegrating µ n relative to µ.
We move on to some results concerning the tricube T n . Recall from [7, Subsection 3. Proof. Let X be a nilspace, let P = ω n ({0, 1} n ) and let f : P → X be a morphism. Then, letting h : Proof. The claim is checked for v = 0 n using the map h : The lemma then follows by the composition axiom for cubespaces.
, let X be a k-step compact nilspace, and let f : P → X be a morphism. Then hom f (T n , X) has a Haar measure.
Proof. This follows again from Lemma 2.25 and Proposition 2.18.
Proof. Note first that we may assume that ω n ∈ C n (T n ), since by [7, Lemma 3.13] this assumption does not affect any set of morphisms from T n into any nilspace. Now since P 1 ∩ P 2 = {1 n } is a singleton, it has the extension property. The set P 1 itself has the extension property, by Lemma 2.31.
Combining this with Lemma 2.27, we obtain that a set of morphisms T n → X with a constraint at the outer points of T n is still large enough to cover a whole set of rooted cubes C n x (X), in the following sense.
Corollary 2.35. Let X be a k-step compact nilspace, let P 1 and P 2 be as in Lemma 2.34, and let f : P 1 → X be a morphism. Then the restriction map hom f (T n , X) → hom 0 n →f (1 n ) (P 2 , X) = C n f (1 n ) (X), t → t • Ψ 0 n preserves the Haar measures.
As a complement to this corollary, we also have that a set of morphisms T n → X with a given constraint at just one outer point is always large enough to cover a full cube set C n (X), as follows.
Lemma 2.36. Let X be a k-step compact nilspace, let x ∈ X, and let Q x denote the compact abelian bundle hom 1 n →x (T n , X). Then for every Proof. There is a Haar measure on Q x by Lemma 2.25. Let P 1 = {1 n } and P 2 = Ψ v ({0, 1} n ). The lemma will follow if we show that P 1 , P 2 form a good pair in T n , by Lemma 2.32. Since the singleton P 1 has the extension property in T n and so does P 1 ∩ P 2 = ∅, it suffices to show that any given morphism We can certainly extend f to a morphism f 2 : T n → D k (Z), by Lemma 2.32. Now v = 0 n implies that Ψ v (0 n ) = 1 n , so this has some coordinate equal to −1, say without loss of generality Ψ v (0 n )(1) = −1. Then the set straightforward calculation shows that g is a morphism, using [7, (2.9)]. Then the function f = f 2 − g is also a morphism T n → D k (Z), it extends f , and satisfies f | P1 = 0.

Topological spaces associated with continuous systems of measures
Definition 2.37. Let X, Y be compact spaces and let µ be a Borel measure on X. We denote by L(X, Y ) the quotient of the set of Borel measurable functions f : X → Y by the equivalence relation ∼ defined In this section, given a continuous system of measures, we construct an associated topological space that will be crucial in the sequel. In order to motivate the construction, let us outline how it will be used.
The central application will be given in the next section, which is one of the main sections of this chapter. The aim there is to show that given a cocycle ρ : C k (X) → Z, for a compact nilspace X and a compact abelian group Z (recall [7, Definition 3.69]), if ρ is Borel measurable then the extension M (ρ) constructed in [7, Proposition 3.80] can be equipped with a compact nilspace structure compatible with that of X. The purpose of the construction in this section is to provide an ambient continuous abelian bundle from which M (ρ) will inherit the desired topological structure. The construction will be completed with Proposition 2.49.
Let us now turn to the definition of the topological space in the construction. To motivate this, consider the general theme of the application mentioned above: given a Borel measurable function on a space (e.g. the cocycle ρ), we have to build a topological space that is associated with the function in a useful way. A very basic example of such a construction is the following: let Z be a compact abelian group, suppose that we only know the Borel σ-algebra on Z (not the underlying topology), and that we are given a Borel function f : Z → R. Then we can build a topology on Z naturally associated with f using the L 1 seminorm on the Borel functions on Z (relative to the Haar measure), by restricting this seminorm to the translates of f , i.e. the functions f z : x → f (x + z), z ∈ Z. More precisely, we can define a pseudometric d on Z by d(z, z ) = f z − f z L 1 (Z) , and then take the topology generated by the open balls with respect to d. The central application mentioned above will use a more elaborate version of this idea. Indeed, recall from [7, (3.9)] that the extension generated by the cocycle ρ is M (ρ) = x∈X {ρ x + z : z ∈ Z}, where for each x we denote by ρ x the restriction of ρ to the set of rooted cubes C k x (X) = {c ∈ C k (X) : c(0 k ) = x}. To put a useful topology on M (ρ), we shall first put an analogue of the L 1 -topology on each family of shifts ρ x + z, z ∈ Z, for each x ∈ X, and we shall then want to tie together adequately these different topologies over different points x into a global topology. Now the Haar measures on sets C k x (X) form a CSM, by Lemma 2.30. This leads to the following definition, which concerns CSMs more generally, and which provides a topology that will be adequate for our purposes.
Definition 2.38. Let V, W, Z be compact spaces, and let {µ w : w ∈ W } be a family of strictly positive Borel probability measures forming a CSM on a continuous map π : V → W . For each function f in w∈W L π −1 (w), Z , letπ(f ) be the element w ∈ W such that f ∈ L(π −1 (w), Z). We define the topological space L(V, Z) to be the set w∈W L π −1 (w), Z equipped with the coarsest topology making the following functions continuous: for every pair of continuous functions F 1 : Z → C and F 2 : V → C.

p. candela
We shall discuss below how this topology relates to the L 1 topology, but for now let us record some of its basic properties.
Proposition 2.39. The topological space L(V, Z) is regular Hausdorff and second-countable, and the mapπ is continuous.
exist continuous functions g, g and a set C ⊂ π −1 (w) of probability at most such that f 0 = g and Urysohn's lemma gives us continuous functions F 1 : Z → [0, 1], and similarly for g , f 0 . Hence, choosing small enough, we deduce that To see that L(V, Z) is regular, first note that since by definition the finite intersections of sets ϕ −1 F1,F2 (U ) form a base for the topology, we have that for every closed set S and f ∈ S, there exist the former contains f , and the latter includes S.
Finally, we show that L(V, Z) is second-countable. It suffices to find sequences of continuous functions . Indeed, if this holds then the finite intersections of sets ϕ −1 F1,i,F2,j (U k ) form a countable base for the topology on L(V, Z). Let {U k : k ∈ N} be a base of open discs in C. The spaces of continuous functions C(V, C) and C(Z, C), equipped with the uniform metric, are separable [23,Theorem (4.19)]. Let (F 1,i ) i∈N and (F 2,j ) j∈N be separating sequences for C(V, C) and C(Z, C) respectively. Given any ϕ F1,F2 , open set U ⊂ C, and f ∈ ϕ −1 F1,F2 (U ), for some > 0 there is a disc U k ⊂ U of radius at most with center at most /2 away from ϕ F1,F2 (f ) and such that the distance from U k to the complement of U is at least .
Then for any g ∈ L(V, Z), letting w =π(g), we have To see this, we can view L(V, Z) as a subspace of a larger space where each fibre L π −1 (w), P (Z) consists of probability-valued functionsf on π −1 (w), i.e. functions The topology on L(V, Z) can be viewed as a generalization of the L 1 topology, as illustrated by the following result.
Lemma 2.41. Let V, W be compact spaces, let Z be the closed unit disc in C, and let w ∈ W . Then a This is a special case of a more general result that we shall use in the sequel, namely Lemma 2.43 below.
This result involves the following generalization of the L 1 distance for functions taking values in a compact metric space.
Definition 2.42. Given a compact space Y with a Borel probability measure, and a compact space Z with a compatible metric d, we define the metric d 1 on L(Y, Z) by Proof. Let ϕ F1,F2 be any of the functions generating the topology on L(V, Z). We then have We claim that if d 1 (f, f n ) → 0 then the last integral tends to 0 as n → ∞. To see this fix any > 0 and note that by uniform continuity of For n sufficiently large we have The claim follows, and so For the converse, suppose that f n → f in L(V, Z). By [23,Theorem (4.17)] and [2, Theorem 1], there exists a compact subset B of the real Hilbert space 2 such that there is a homeomorphism F : Z → B.
This proves our claim. We now show that By definition of the Bochner integral, it suffices to prove this for simple functions F 0 . By linearity, it then suffices to prove it for F 0 of the form α 1 A where A ⊂ π −1 (w) is measurable and α ∈ 2 (R). But in this case the function F 1 : Z → R, z → F (z), α is continuous, and the function 1 A : π −1 (w) → R can be approximated in L 1 (µ w ) by continuous functions, hence in this case the convergence follows from the definition of the topology on L(V, Z).
, which converges to ϕ F1,F2 (f ) as required. From the last two paragraphs we deduce the desired convergence by a standard argument, namely It is a basic fact that if (f n ) is a sequence of real-valued functions on a standard probability space such that f n → f in L 1 and each f n is constant almost surely, then the limit f is also constant almost surely.
We shall use the following analogous fact for L(V, Z).
Lemma 2.44. Let V, W, Z be compact spaces, let {µ w : w ∈ W } be a CSM on π : V → W , and let (f n ) be a convergent sequence in L(V, Z) such that each f n is constant almost surely on its fibre π −1 (w n ).
Then the limit is also constant almost surely.
Proof. Let f be the limit of the sequence (f n On the other hand, since each f n is constant almost By the equality case of the Cauchy-Schwarz inequality, this implies that F • f is constant almost everywhere.
The following result will be used several times in the next section.
Lemma 2.45. Let V, W, Z be compact spaces, and let {µ w : w ∈ W } be a CSM on π : V → W .
Suppose that (f n ) and (g n ) are sequences in L(V, Z) converging to f and g respectively, where f n , g n are defined on π −1 (w n ) and f, g are defined on π −1 (w).
Proof. It suffices to show that for any continuous functions are continuous, so we may assume that F 1 is of this form. Fix any > 0. By Lusin's theorem there exists a continuous function q : Using that g n → g in L(V, Z), that w n → w, and the uniform continuity of q, we deduce that the integral Combining the above estimates we deduce that for all n sufficiently large we have Since > 0 was arbitrary, the result follows.
For the main applications of the space L(V, Z) in the sequel, we will suppose that Z is a compact abelian group. We now show that in this case the group has a continuous action on the space.
Lemma 2.46. Let V, W be compact spaces, let Z be a compact abelian group, and let {µ w : w ∈ W } be a CSM on π : V → W . Then we have the following free continuous action of Z on L(V, Z): Proof. The topology on L(V, Z) is generated by the functions ϕ F1,F2 , so to check continuity of α it suffices to show that for every ϕ F1,F2 the map ϕ F1,F2 • α is continuous. Thus, it suffices to show that for any continuous functions F 1 : Z → C and F 2 : V → C, the following function is continuous: Applying the Stone-Weierstrass theorem as in previous proofs, the continuous function Z × Z → C defined by (z 1 , z 2 ) → F 1 (z 1 + z 2 ) can be approximated uniformly by linear combinations of functions of the form where h 1 and h 2 are continuous. Substituting any of these into (2.10), we obtain a function of the form This is continuous by definition of L(V, Z). Hence q is a uniform limit of continuous functions and is therefore continuous.
In our uses of L(V, Z), we shall want to view this space as a continuous Z-bundle, for some appropriate base S and projection E. We would like S, E to have the following features. Firstly, the projection should A natural way to obtain these features is to define E as a difference map, sending f to the function . We are thus led to the following construction.
Definition 2.47. Let V, W be compact spaces and let {µ w : w ∈ W } be a CSM on π : V → W . We define the compact space and define the projection π : is proved by an argument similar to previous ones (e.g. in the proof of Lemma 2.46), showing that this function is a uniform limit of continuous functions F n , where F n is obtained by approximating f to within 1/n in the supremum norm by a finite linear combination of and then using the continuity of w → i=0,1 π −1 (w) h i dµ w guaranteed by the CSM on π.
We are now able to complete the construction of the continuous abelian bundle announced at the beginning of this section, by showing that the map E has the required properties to be a suitable projection.
notes on compact nilspaces Proposition 2.49. Let V, W be compact spaces, let {µ w : w ∈ W } be a CSM on π : V → W , and let Z be a compact abelian group. Let E : To see that E is continuous, fix any such function and suppose that g n → g in L(V, Z). Then, approximating the continuous functions (z 0 , z 1 ) → where ϕ 0 , ϕ 1 are functions among those generating the L(V, Z) topology. By assumption, each of these products satisfies ϕ 0 (g n )ϕ 1 (g n ) → ϕ 0 (g)ϕ 1 (g), and it follows that ϕ F1,F2 (E(g n )) → ϕ F1,F2 (E(g)). This proves the continuity of E.
To ensure that we have a continuous Z-bundle, it only remains to check the 'if' part of condition (iv) in Definition 2.6. Equivalently, it now suffices to prove that if E −1 (U ) is closed then U is closed.
For that, we claim it is enough to show that if for a sequence of functions f n ∈ L(V, Z) the images E(f n ) converge, then there is a convergent subsequence (f m ) of (f n ). Indeed, suppose that this holds and suppose for a contradiction that U is not closed. Then (using the surjectivity of E) there is a sequence of But then letting f be the limit of the guaranteed subsequence (f m ), the closure of E −1 (U ) implies that f ∈ E −1 (U ), and so by continuity of E we have This proves our claim.
So let us suppose that E(f n ) converges to E(f ) for some f ∈ L(V, Z). Let w n =π(f n ) and w =π(f ), and note that w n → w in W by continuity ofπ.
Let C denote the circle group, viewed as the unit circle in C. We shall prove the following fact: There exists a subsequence (f m ) and some t ∈ Z such that, for every character (2.11) We prove this below, but before that let us show how it implies that f m converges to f + t in L(V, Z).
Let ϕ F1,F2 be any of the functions generating the L(V, Z) topology, and note that by the Stone-Weierstrass theorem for every > 0 there exists a trigonometric polynomial F 1 = j∈[K] λ j χ j on Z such that F 1 − F 1 ∞ ≤ . Therefore it suffices to show that ϕ F 1 ,F2 (f m ) → ϕ F 1 ,F2 (f + t) for any such polynomial F 1 . We have Since ϕ 1,F2 is one of the functions generating the topology on L(V, C), we have ) by assumption, and the desired convergence follows.
We now prove (2.11). Given χ ∈ Z, the function χ•f is in L 2 (µ w ). Continuous functions are dense in this space, and any such function can be extended to a continuous function on V (by the Tietze extension theorem). Hence, for every δ > 0 there exists a continuous function χ δ : V → C whose restriction to π −1 (w) satisfies χ δ − χ • f L 2 (µw) ≤ δ. We claim that for every χ ∈ Z and > 0, there exist δ > 0, N ∈ N, and λ ∈ C, such that for all n > N we have (χ • f n ) χ δ − λ L 2 (µw n ) ≤ .
To prove this claim, let E : L(V, C) → L(V × W V, C) be defined by E (g) : (v 0 , v 1 ) → g(v 0 )g(v 1 ). We have that E is continuous, by an argument similar to the one used above for E. It is also clear that for any g 1 , g 2 ∈ L(V, C) lying in the same fibre ofπ we have E (g 1 g 2 ) = E (g 1 ) E (g 2 ), and that E (χ • g) = χ • E(g) for every χ ∈ Z, g ∈ L(V, Z). Now, from the definition of χ δ , the continuity of E , and Lemma 2.43, it follows that for δ sufficiently small we have E (χ • f ) χ δ − 1 L 2 (µw×µw) ≤ /2. On the other hand, we and similarly for f . This together with the assumption E(f n ) → E(f ) implies, by an argument similar to (2.9), that for n sufficiently large we have Taking a minimum over v 1 in this integral, we deduce that there Since there are at most countably many elements in Z, it follows by a standard diagonalization argument (using the above claim with smaller and smaller for each χ) that for some sequence (m n ) n∈N of positive integers, for every χ ∈ Z there is a constant λ χ ∈ C such that χ as n → ∞. A straightforward calculation shows that the function χ → λ χ is a homomorphism, hence a character on Z, which by duality must be of the form χ → χ(t) for some t ∈ Z. This confirms (2.11) and completes the proof.
We close this section with two technical lemmas that we shall use several times.
Lemma 2.50. Let {µ w : w ∈ W } be a CSM on π : V → W . Let K be a compact space with a Borel measure ν. Suppose that f 1 : V → K is continuous and that, for every w ∈ W , the restriction of f 1 to Proof. By definition of the topology on L(V, Z) it suffices to show that for every ϕ F1,F2 the function ϕ F1,F2 • h : W → C is continuous. So let F 1 : Z → C and F 2 : V → C be continuous and let q denote To prove that q is continuous we show that it is a uniform limit of continuous functions.
Fix an arbitrary > 0. By Lusin's theorem there exists a continuous function F 3 : K → C such that

the triangle inequality and
the assumption that f 1 is measure-preserving imply that sup w∈W |q(w) − q (w)| ≤ F 2 ∞ . The function q is continuous by condition (ii) from Definition 2.14. The result follows.
Lemma 2.51. Let {µ w : w ∈ W } be a CSM on π : V → W , let Z be a compact abelian group, let P be a finite set, and for each r ∈ P let λ r be an integer. Let Σ P : where π r is the projection to the r-component on Z P . Then Σ P is continuous.

Borel measurable cocycles generate compact extensions
Let X be a compact nilspace and let Z be a compact abelian group. The purpose of this section is to show that any measurable cocycle ρ : C k (X) → Z yields a compact nilspace that is a Z-bundle over X.
Recall that for each x ∈ X we denote by C k x (X) the set of k-cubes c satisfying π(c) := c(0 k ) = x. By Lemma 2.30 each space C k x (X) has a Haar measure, denoted µ x , and the family {µ x : x ∈ X} is a CSM on π of strictly positive measures.
Definition 2.52. We denote by L k (X, Z) the space L(V, Z) with V = C n (X), W = X, and π : c → c(0 k ).
Thus L k (X, Z) = x∈X L C k x (X), Z , its topology is second-countable regular Hausdorff, and we have a projectionπ : For such a function f , we denote by f + Z the set of functions {f + z : z ∈ Z}.
The desired nilspace extending X is found inside L k (X, Z) by taking, for each x ∈ X, the orbit of the restricted cocycle ρ x = ρ| C k x (X) . Proposition 2.53. Let ρ : C k (X) → Z be a Borel measurable cocycle and let M = x∈X (ρ x + Z). Then, as a subspace of L k (X, Z) with the inherited Z-action, the space M is a compact Z-bundle over X.
Proof. Let Y = C k (X) × X C k (X), that is (recalling the notation from Proposition 2.49), Recall that E : . We now compose the function x → ρ x with E, obtaining the function x → E(ρ x ).
Note that g is injective, and that its inverse is the projectionπ on L(Y, Z), a continuous map. We have x (X). Now, by Proposition 2.49 the preimage under E of every point is a compact set (homeomorphic to Z), and E is also a closed map (using Remark 2.7). Hence E is a proper map (see [5, §10.2, Theorem 1]).
In particular, the preimage under E of any compact set is compact ([5, §10.2, Proposition 6]). Therefore, if we show that g is continuous, then g (X) is compact and then M must be compact, by (2.13). (Note that M is then also a continuous Z-bundle over X, since by (2.13) it is such a bundle over g (X), and g is a homeomorphism X → g (X).) To prove the continuity of g , the key idea is to express this function in terms of compositions of ρ with certain tricube morphisms T k → X (recall [7, Definition 3.10]), and thereby to use these morphisms in a smoothening operation that turns the measurability of ρ into the continuity of g .

p. candela
We claim that g v is continuous. Indeed, by Lemma 2.36 if v = 0 k then t → t • Ψ v is measure-preserving from Q x to C k (X), so we can deduce the continuity of g v by applying Lemma 2.50 (setting V = Q, Now consider the following function: The continuity of each function g v implies that g is continuous. Indeed, letting P = {0, 1} k \ {0 k }, by Lemma 2.45 the function X → L(Q, Z P ), x → v∈P g v (x) is continuous, and then Lemma 2.51 gives the continuity of g. Now, by [7, Lemma 3.85], for each x ∈ X we have that g(x) is the function In particular, given any t ∈ Q x , we have that c 0 := t • ω k and . Given this equality, we now claim that continuity of g follows from continuity of g. Indeed, we know that g is continuous if for any of the functions ϕ F1,F2 generating the topology on L(Y, Z) we we show that this map is surjective and measure-preserving, then since g ( and continuity of g would then indeed follow from that of g (via approximating the measurable function To see that θ is measure-preserving, first note that by Lemma 2.27 there is a CSM on the map • ω k consisting of the Haar probabilities on the fibres, giving a disintegration of the Haar probability on Q x . On each of these fibres, of the form hom c • ω −1 k (T k , X), c ∈ C k x (X), it follows from Corollary 2.35 that the map hom c • ω −1 k (T k , X) → C k x (X), t → t • Ψ 0 k preserves the Haar measures. Using this, a straightforward calculation shows that for product sets , and it follows that θ is measure-preserving as claimed.
Let us now recall the definition of cubes on M from [7, Definition 3.79]. Note that, by definition of M , for Definition 2.54. We define C k (M ) to be the set of functions f : {0, 1} k → M such thatπ • f ∈ C k (X) and ρ(π • f ) = σ k (a). (2.14) For n = k, a function f : {0, 1} n → M is declared to be in C n (M ) ifπ • f ∈ C n (X) and every k-dimensional face-restriction of f is in C k (M ).

notes on compact nilspaces
We can now complete the main task of this section. is a closed subset of M {0,1} k . We use the probability space Q = hom(T k , X) again, but this time we let Sinceπ is continuous and C k (X) is closed, we have that R k (M ) is closed in M {0,1} k . We define the following map: Arguing as in the proof of [7, Lemma 3.86], we see that φ f is actually a constant function for every Hence it now suffices to show that φ is continuous, as then C k (M ) is closed as required.
To see the continuity of φ, we first express it as the composition of simpler functions. For each v ∈ {0, 1} k , let We claim that φ v is continuous. To see this, we suppose that f n → f in R k (M ), which implies that the component f n (v) converges to f (v) in M , and we want to show that then φ v,fn → φ v,f in L(Q, Z).
For this it suffices to show that ϕ F 1 ,F 2 (φ v,fn ) → ϕ F 1 ,F 2 (φ v,f ) for any continuous functions F 1 : Z → C, We shall now show that, for one of the functions ϕ F1,F2 generating the topology on M , we have is a continuous function of c = t • Ψ v ∈ C k (X), by Definition 2.14. We can now use the fact that This is of the form ϕ F 1 ,F 2 (f (v)) as in (2.15), and the continuity of φ v follows.
The continuity of each function φ v implies that the following function is continuous: The lemma tells us that Σ P is continuous, and so φ is continuous.
Recall from [7, Lemma 3.82] that, up to isomorphisms of nilspaces, every extension of X by Z is of the form M (ρ) above for some cocycle ρ. 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 [7, Lemma 3.75] that given a degree-k extension of a nilspace, every cross section s for this extension generates a cocycle, denoted ρ s . We now show that for compact nilspaces one can take ρ s to be Borel measurable.
Lemma 2.56. Let X be a compact nilspace, and let Y be a compact nilspace that is a degree-k extension of X by a compact abelian group Z. Then there is a Borel cross section s for this extension and therefore a Borel cocycle ρ s : C k+1 (X) → Z.
Proof. Let π : Y → X be the projection of the extension. Let P = {(x, y) ∈ X × Y : π(y) = x}. A cross-section for π is a subset of P which happens to be the graph of a function X → Y. Let P(Y) denote the set of Borel probability measures on Y. By [23, Corollary 18.7], a sufficient condition for a Borel cross section to exist is that for some Borel function µ : X → P(Y) we have µ x (P ∩ ({x} × Y)) > 0.
The measures µ x from the CSM structure on π satisfy this, and the function x → µ x is continuous, by Definition 2.14. There is therefore a Borel cross section s : X → Y. We can then define a Borel function there is a Borel cross section c → c 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 [24,Theorem 1]. We extend the case of compact abelian groups as follows.
notes on compact nilspaces Theorem 2.57. Let X, Y be compact nilspaces of finite step, and let φ : X → Y be a Borel measurable morphism. Then φ is continuous.
Proof. Suppose that Y is a (k − 1)-step nilspace, and consider the CSM on π : C k (X) → X, c → c(0 k ), given by Lemma 2.30.
. We have that π v is continuous and each of its restrictions to a space C k x (X) is measure-preserving, by Lemma 2.27 (applied with P 1 = {0 k }, P 2 = {v} and f : 0 k → x, identifying hom f | P 1 ∩P 2 (P 2 , X) with X). Now for each v let f v : X → L(C k (X), Y) be the function sending x to the restriction φ • π v | C k x (X) . Then f v is continuous, by Lemma 2.50 (applied with V = C k (X), W = K = X, f 1 = π v and f 2 = φ).
Let f : X → L C k (X), Y be the function mapping x ∈ X to the constant function with value φ(x) on C k x (X). From the definition of L C k (X), Y it follows that if f is continuous then so is φ.
To see that f is continuous, recall that Cor k (Y) denotes the space of k-corners on Y and consider the following function: Combining the continuity of each function f v with Lemma 2.45, we deduce that ξ is continuous. Now let K denote the function L C k (X), Cor k (Y) → L C k (X), Y that sends a function g to K • g, where K : Cor k (Y) → Y is the unique completion of k-corners on Y. By Lemma 2.12 we know that K is continuous, and we claim that K is therefore continuous. Indeed, suppose we have a sequence g n in L C k (X), Cor k (Y) converging to g, and let F 1 : Y → C and F 2 : C k (X) → C be continuous. Then where ϕ F1 • K,F2 is one of the functions generating the topology on L(C k (X), Cor k (Y)). Hence by assumption this converges to ϕ F1 • K,F2 (g) = ϕ F1,F2 (K(g)), so K is continuous.
Finally, note that f = K • ξ, so f is continuous, which completes the proof.
We are now able to prove the analogue of [7, Lemma 3.82] for compact nilspaces.
Lemma 2.58. Let X be a compact nilspace of finite step. Let Y be a degree-k extension of X by a compact abelian group Z. Let s : X → Y be a Borel cross-section and let ρ = ρ s be the associated Borel cocycle.
Then Y is isomorphic as a compact nilspace to the extension M (ρ) from Proposition 2.53.
Proof. Let π : Y → X be the projection for the extension. The isomorphism is given by the following map:

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 2.62). We then define an averaging operation for certain functions on these spaces, which enables us to prove a useful rigidity result concerning cocycles (Lemma 2.66).
Definition 2.60. Let B be a k-fold compact abelian bundle, with structure groups Z 1 , . . . , Z k . We define the rank of B by where Z i is the Pontryagin dual of Z i and rk( Z i ) is the minimal number of generators of Z i . If X is a k-step compact nilspace then we define its rank rk(X) to be rk(B) for the associated bundle B given by Proposition 2.9.
When working with a compact Z-bundle B over S, we shall often want to ensure that the bundle is locally trivial, meaning that for every x ∈ B there is an open set U ⊂ S containing the projection π(x), and a homeomorphism π −1 (U ) → U × Z of the form x → (π(x), ϕ(x)) where ϕ : π −1 (U ) → Z is Z-equivariant (that is ϕ(x + z) = ϕ(x) + z for every x ∈ π −1 (U ), z ∈ Z). A theorem of Gleason [ Recalling that a compact abelian group is a Lie group if and only if it has finite rank, we deduce the following result.
Lemma 2.62. Let X be a k-step compact nilspace of finite rank with structure groups Z 1 , . . . , Z k and factors X 0 , . . . , X k . Then X i is a locally trivial Z i -bundle over X i−1 for each i ∈ [k].
Thus, topologically a k-step compact nilspace of finite rank is a finite dimensional manifold.
Definition 2.63. Recall that every compact abelian Lie group Z is isomorphic to a direct product F ×T n for some finite abelian group F and n ≥ 0. We can then define a natural metric d 2 on Z as follows. For two elements x, y ∈ T n = R n /Z n we define d 2 (x, y) as the minimum of the Euclidean distances between preimages of x and y under the map R n → R n /Z n . If Z is not connected, then for points x, y in different connected components we declare that d 2 (x, y) = ∞.

notes on compact nilspaces
We now turn to the definition of averaging for a function on a nilspace taking values in a compact abelian group Z. Here we face the problem that in general the average of a Z-valued function is not well-defined. This is clear already in the simple case of the circle group Z = 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 T-valued function to a real-valued one, then take the usual average, and then project the obtained value back to T. We capture this idea more generally as follows.
Definition 2.64. Let Z ∼ = F × T n be a compact abelian Lie group. Let f be a Borel measurable function from a probability space X to Z, and suppose there exists z = (g, θ) ∈ Z, (θ ∈ T n ) such that every value of f lies in the ball B 1/4 (z) in the metric d 2 . Then, letting π denote the projection R n → T n , for any fixed lift θ ∈ R n there is a unique function f : X → R n such that f (x) = (g, π • f (x)) and f takes all its values in B z (1/4) in the euclidean distance. We then define the average value Ef to be (g, π(Ef )).
Note that E(f ) does not depend on the choice of the lift of z. Let us say that a function f : Lemma 2.65. Let Z be a compact abelian Lie group, and let m ∈ N. Then for any (1/4m)-concentrated measurable functions f 1 , . . . , f m from a probability space X to Z, the average of f 1 + · · · + f m is well defined and satisfies E(f 1 + · · · + f m ) = Ef 1 + · · · + Ef m . Proof.
The assumption implies that f 1 + · · · + 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 [7, Definition 3.73] that a function C k (X) → Z is called a coboundary if it is of the form c → σ k (f • c) for some function f : X → Z.
Lemma 2.66. Let X be a compact -step nilspace and let Z be a compact abelian group of finite rank.
There exists > 0 such that, for every Borel measurable cocycle ρ : C k (X) → Z, if d 2 (ρ(c), 0) ≤ for every c ∈ C k (X) then there exists a Borel measurable function g : X → Z such that ρ is the coboundary c → σ k (g • c).
Proof. For any x ∈ X, consider the space of cubes C k x (X) with the Haar probability given by Lemma 2.30. By assumption ρ is -concentrated on C k x (X), so we may define Fix any c ∈ C k (X) and let Ω = hom c • ω −1 k (T k , X). For any t ∈ Ω, by [7, Lemma 3.85] we have ρ(c) = v∈{0,1} k (−1) |v| ρ(t • Ψ v ). By Corollary 2.35, we have that for each v the map t → t • Ψ v , Ω → C k c(v) (X) preserves the Haar measures (where the Haar measure on Ω is given by Corollary 2.33). Hence, by averaging over t in the last equation, we obtain ρ(c) = v∈{0,1} k (−1) |v| g(c(v)) = σ k (g • c).

Counting isomorphism classes of compact finite-rank nilspaces
In this section we use the parametrization of compact extensions by cocycles, given in Corollary 2.59, to prove the following result.
Theorem 2.67. There are countably many isomorphism classes of compact nilspaces of finite rank.
To prove this we shall use the following lemma, that strengthens Lemma 2.66 by allowing its premise to fail on a null set.
Lemma 2.68. Let X be a compact -step nilspace and Z be a compact abelian group of finite rank. Then there exists > 0 such that every Borel measurable cocycle ρ : C k (X) → Z satisfying d 2 (ρ(c), 0) ≤ for almost every c ∈ C k (X) is a coboundary.
This relies on the following fact.
Lemma 2.69. Let X be a compact -step nilspace and let Z be a compact abelian group of finite rank.
Let ρ : C k (X) → Z be a Borel measurable cocycle such that ρ = 0 for almost every element in C k (X).
Then ρ is a coboundary.
Proof. Let S = {x ∈ X : ρ x = 0 almost surely on C k x (X)}. It follows from the properties of the CSM on C k (X) → X, c → c(0 k ) (given by Lemma 2.30) that S has probability 1. For every x ∈ S the set ρ x + Z ⊂ L k (X, Z) consists of functions that are constant almost everywhere. Since by Proposition 2.24 every open set in X has positive measure, we have that S is dense in X. We claim that for every x ∈ X the function ρ x equals a constant almost everywhere. Indeed, by density of S there exists a sequence of points x n ∈ S converging to x. For each n choose an element ρ xn + a n ∈ M (ρ) equal to a constant almost surely. By Proposition 2.53 the extension M is compact and so there is a subsequence of such functions ρ xm + a m converging in M . By Lemma 2.44, the limit is constant almost everywhere, and (as a point of M ) is ρ x + a for some a ∈ Z, which proves our claim. From this, we deduce that the function g : X → Z, x → E c∈C k x (X) ρ(c) is well-defined and that for each x ∈ X we have ρ(c) = g(x) for almost every c ∈ C k x (X). We now claim that for every x ∈ X, we have ρ(c) = σ k (g • c) for almost every c ∈ C k (X). This follows from an argument similar to the second paragraph in the proof of Lemma 2.66. Thus, denoting by f the coboundary c → σ k (g • c), the cocycle ρ = ρ − f has the property that for every x ∈ X we have ρ x = 0 almost surely on C k x (X). This implies that ρ = 0 everywhere. Indeed, for an arbitrary fixed c ∈ C k (X), and any t ∈ hom c • ω −1 k (T k , X), by [7,Lemma 3.85] we have ρ (c) = β(t, ρ ), and then, averaging both sides of this equation over t, the right side vanishes since ρ x is 0 almost everywhere (using again that each map t → t • Ψ v is probability-preserving, by Corollary 2.35).
Proof of Lemma 2.68. We argue as in the proof of Lemma 2.66. Let S be the set of elements x ∈ X for which ρ x is almost surely within of 0 in d 2 . By the assumption, we have that S has probability 1.
We define g : X → Z for x ∈ S by g(x) = E C k x (X) ρ(c), and for x ∈ X \S by setting g(x) = 0. Letting ρ 2 (c) = σ k (g • c), the same averaging argument shows that ρ 2 = ρ almost surely. By Lemma 2.69 the difference ρ − ρ 2 is a coboundary, whence ρ is a coboundary.
We can now prove the main result of this section.
Proof of Theorem 2.67. We claim that for every k ∈ N, for every compact (k − 1)-step nilspace X of finite rank and every compact abelian Lie group Z, there are at most countably many non-isomorphic degree-k extensions of X by Z. This implies the theorem by induction on k.
To prove the claim, we first associate with each Z-extension of X a measurable cocycle ρ s generated by a piecewise-continuous cross section s for the extension. We construct s as follows.
Since X is a finite-dimensional compact manifold, there exist disjoint open sets U 1 , U 2 , . . . , U r , each homeomorphic to the open unit Euclidean ball in R n for some n ≥ 0, such that U = i∈[r] U i has measure 1 in X. Let M denote the given degree-k extension of X by Z, with projection π : M → X. Every Zbundle over a contractible space is trivial [22,Ch. 4,Corollary 10.3]. Therefore there exists a continuous cross section s i locally on each U i , and combining these we obtain a piecewise continuous (hence Borelmeasurable) cross section s : X → M , with s | Ui = s i . Let T ⊆ C k+1 (X) denote the set of cubes whose vertices are all in U . We can partition the cubes c ∈ T according to which set U i contains each value

Compact nilspaces as inverse limits of finite-rank nilspaces
In this section we treat one of the central results from [8], 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 2.70. An inverse system (or projective system) of compact nilspaces over N is a family of continuous nilspace morphisms {ϕ ij : X j → X i | i, j ∈ N, i ≤ j}, where X j , j ∈ N are compact nilspaces, such that ϕ jj is the identity morphism for all j ∈ N, and for all i, j, k ∈ N with i ≤ j ≤ k we have ϕ ij • ϕ jk = ϕ ik . The inverse system is said to be strict if every morphism ϕ ij is fibre-surjective. Lemma 2.71. Let S = (ϕ ij : X j → X i ) i≤j be a strict inverse system of compact nilspaces. Let The space X together with the cube sets C n (X) is a compact nilspace, called the inverse limit of S, and denoted lim We have that X is k-step if and only if every X i is k-step.
We call the maps ϕ ij the transition morphisms. The projections on X, denoted ϕ j , j ∈ N, are the coordinate projections on i∈N X i restricted to X. Note that if the inverse system is strict then the projections are also fibre-surjective morphisms. Note that the -th structure group of lim ← −i X i is the inverse limit of the system (α ,ij : Z ,j → Z ,i ) i≤j , where Z ,j is the -th structure group of X j and α ,ij is the -th structure morphism of ϕ ij .
Proof. A straightforward argument with convergent sequences shows that X is a closed subspace of the compact space i∈N X i , and similarly for each set C n (X). The ergodicity and composition axioms are We can now state the central result of this section.
Theorem 2.72. 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 [19,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 2.72.
Proposition 2.73. Let X be a k-step compact nilspace. Then X is an inverse limit of k-step nilspaces X i , each having k-th structure group a compact abelian Lie group, and having factor F k−1 (X i ) isomorphic to F k−1 (X).
Proof. By the standard result for compact abelian groups recalled above, for the k-th structure group Z k of X we have for each i ∈ N a compact abelian Lie group Z k,i and a surjective continuous homomorphism x ∈ Z k,j ∼ = Z k / ker α j .) Define for each i the k-step compact nilspace X i as the image of X under the map ϕ i that sends x ∈ X to the orbit x + ker α i . A straightforward calculation shows that X i , with the quotient cube-structure of X by ker α i and the quotient topology, is a k-step compact nilspace with k-th structure group Z k,i . The projections X → F k−1 (X) and X i → F k−1 (X i ) are both given by the orbit map for the Z k -action, and it follows that F k−1 (X) ∼ = F k−1 (X i ) as compact nilspaces. The transition morphisms ϕ ij : X j → X i , defined by x + ker α j → x + ker α i , are all clearly fibre-surjective.
Recall from [7,Lemma 3.75] that given a degree-k extension Y of X by Z, and given a cross section s : X → Y, letting f : Y → Z, y → s • π(y) − y, the cocycle generated by s is the degree-k cocycle For the proof of Theorem 2.72, it will be useful to be able to tell in a simple way whether a given cocycle on a nilspace X induces a well-defined cocycle on another nilspace X via some given fibre-surjective morphism X → X . The following definition provides such a criterion.
Definition 2.74. Let X be a k-step compact nilspace, and for some compact nilspace X let ψ : F k−1 (X) → X be a continuous fibre-surjective morphism. We say that a measurable cross section Thus if s is consistent with X then ρ s induces a cocycle ρ : C k+1 (X ) → Z k , well-defined by ρ (c ) = ρ s (c) for any c such that ψ • c = c . Note that we shall often refer to the image of a fibre-surjective morphism on X as a fibre-surjective factor of X.
Lemma 2.75. Let ψ : F k−1 (X) → X be a fibre-surjective morphism and let s : F k−1 (X) → X be a cross section consistent with X . Let ∼ be the equivalence relation on X defined by Then the quotient nilspace X / ∼ is a fibre-surjective factor of X which is an extension of X by Z k .
Proof. Let ρ : C k+1 (X ) → Z k be the cocycle induced by ρ s . Let M (ρ ) be the compact nilspace extending X by Z k given by Proposition 2.53. Let f : X → M (ρ ) be defined by Using Definition 2.54 we check that f is a morphism (a similar calculation appears in the proof of [7, Lemma 3.82]). It is also checked easily that f is fibre-surjective. Moreover, we clearly have f ( if and only if x 1 ∼ x 2 . It follows that f factors through ∼ giving a bijective measurable morphism f : X / ∼ → Y. Then f must be a continuous isomorphism of compact nilspaces, by Theorem 2.57.
The following lemma will be used in the proof of Theorem 2.72 and also in Section 2.9.
Lemma 2.76. Let X be a k-step compact nilspace such that the k-th structure group Z k has finite rank, and let d be a compatible metric on X. Then for any > 0 there exists δ > 0 such that the following holds. Let x 0 , x 1 , y 0 , y 1 ∈ X be such that π k−1 (x i ) = π k−1 (y i ) for i = 0, 1 and d(x 0 , x 1 ), d(y 0 , y 1 ) are both at most δ. Then in Z k we have d 2 (y 0 − x 0 , y 1 − x 1 ) ≤ .
Here d 2 is the metric from Definition 2.63.
This together with d(y 0 , y 1 ) ≤ δ implies that d(φ(y 0 ), y 1 ) ≤ 2δ. Thus, the lemma will follow if we prove the following statement: for every > 0 there exists δ > 0 such that whenever x 1 , x 2 , x 3 ∈ X are in the same fibre of π k−1 and d( This can be shown by a straightforward argument using the local triviality of the Z k -bundle X and the compactness of X k−1 .

Proof of the inverse limit theorem
To prove Theorem 2.72, we argue by induction on k, starting with the trivial case k = 0. For k > 0 we suppose that X is a k-step compact nilspace such that the nilspace Y = F k−1 (X) is the inverse limit of a strict inverse system (τ ij : Y j → Y i ) i,j∈N,i≤j . We denote by π the projection X → Y, and for each i Since by assumption the topology on Y is the initial topology generated by the maps τ i , we have that the finite intersections of sets in i∈N Q i form a base for this topology.

The inductive step: construction of the sequence S
We now apply Proposition 2.73 to X. Thus, letting B 0 = Z k be the k-th structure group of X, and letting B i = ker α i ≤ Z k for each i ∈ N (for the homomorphisms α i from the proof of the proposition), we have B 0 ≥ B 1 ≥ · · · , with i∈N B i = {0}, and X = lim ← −i X / Bi . Let q i−1,i denote the transition morphism X / Bi → X / Bi−1 and q i the projection X → X / Bi . Note that X / Bi has k-th structure group Z k /B i , of finite rank.
The main goal of the inductive step is to construct, starting with the 1-point nilspace X 0 , a sequence where for each i we have a compact nilspace X i of finite rank, and fibre-surjective morphisms ψ i : X / Bi → X i and ψ i : X i → X i−1 , with the following properties: (i) For every i, the restriction of ψ i to each class of ∼ k−1 in X / Bi is injective. In other words, the k-th structure group of X i is the same as that of X / Bi , namely Z k /B i .
(iii) Letting π i denote the projection X i → F k−1 (X i ), and κ i denote the projection X / Bi → Y, we have Properties (i) and (iii) imply that any two distinct points in X are separated by a map ψ i • q i for some i, so the initial topology on X generated by these maps is Hausdorff. Since the original topology on X is compact, it follows that this initial topology equals the original topology (see [5,§9.4,Corollary 3]).
The maps ϕ ij = ψ i+1 • · · · • ψ j and ϕ i := ψ i • q i satisfy the relations ϕ ij • ϕ j = ϕ i thanks to property (ii). Hence X is the inverse limit of the system (ϕ ij : notes on compact nilspaces We shall now construct the sequence S inductively starting from X 0 . Suppose that (X i , ψ i , ψ i , h i ) has been constructed for i ≤ m. Then, to begin with, we construct a Borel cocycle C k+1 (Y) → Z k /B m+1 generated by a cross section s that is almost consistent with some appropriate factor of Y.
Constructing a measurable cross section s: since X m is a compact locally-trivial Z k /B m -bundle over Y hm , there is a finite cover of Y hm by closed subsets W 1 , . . . , W r such that every preimage π −1 m (W i ) ⊂ X m is a trivial Z k /B m -bundle over W i . For each i ∈ [r], let θ i : W i → X m be a continuous cross section (thus π m • θ i is the identity map on W i ).
For each a ∈ [r] let W a denote the preimage of the set θ i (W a ) under ψ m • q m,m+1 : X / Bm+1 → X m .
Note that W a is a Z k /B m+1 -bundle over τ −1 hm (W a ) ⊂ Y, so it is locally trivial by Proposition 2.61. Let d be a metric on X / Bm+1 generating its topology.
Now fix an arbitrary > 0. We claim that for every p ∈ τ −1 hm (W a ) there exists an open set U p ⊂ τ −1 hm (W a ) containing p with the following properties: p. candela (iv) There exists a continuous cross section s p : U p → X / Bm+1 .
(v) The diameter of s p (U p ) in the metric d is at most .
(vi) For some t(p) ∈ N, the set U p is in the collection 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 i Q i generates the topology on Y and for every i ≤ j and open Q ⊂ Y i we have τ −1 Since Y is compact there exists a finite cover by such sets U p , thus for some points p 1 , p 2 , . . . , p n we . Let t a = max{t(p i ) : i ∈ [n]}, so that for every i ∈ [n] we have U pi ⊂ Q ta . Then, by dividing τ −1 hm (W a ) into the atoms of the Boolean algebra generated by U p1 , . . . , U pn , and then using one of the cross sections s p for each atom, we can construct a Borel measurable cross section s a : τ −1 hm (W a ) → X / Bm+1 with the following properties: (vii) The cross section s a is continuous on τ −1 ta (v) for every v ∈ Y ta . (viii) The diameter of s a (τ −1 ta (v)) in d is at most for every v ∈ Y ta . Note that we obtain (viii) from (v) because each τ −1 ta (v) is entirely contained in an atom of the Boolean algebra, which contains τ −1 ta (Q) for some open Q ⊃ v. Let t = max{t a : a ∈ [r]} ∪ {h m + 1}. Using these partial cross sections, we now claim that we can construct a global Borel cross section s : Y → X / Bm+1 with the following properties: (ix) The cross section s is continuous on every preimage Indeed, we can construct s by again dividing Y into the atoms of the Boolean algebra generated by the sets τ −1 hm (W a ) and then using one of the cross sections s a on each atom. This immediately gives (ix) and (x), and then (xi) follows from (iii) above.
Let ρ s : C k+1 (Y) → Z k /B m+1 be the cocycle generated by s. Now for any fixed 2 > 0, we note that if > 0 is small enough, then property (x) implies the following fact, which tells us that s is almost consistent with the factor Y t : (2.17) Note that property (xi) also implies that

notes on compact nilspaces
To complete the proof we shall now use ρ s to find a new cross section s : Y → X /B m+1 that is consistent with the factor Y t , and that is also congruent to s modulo B m , that is q m,m+1 • s = q m,m+1 • s. If we find s then, firstly, thanks to the consistency, we can apply Lemma 2.75 with map ψ = τ t , obtaining a new fibre-surjective factor X m+1 of X / Bm+1 that is an extension of Y t by Z k /B m+1 , and so (i) holds.
Averaging ρ s to obtain a fibre-surjective factor X m+1 of X / Bm+1 : to find s , the idea is firstly to define a new function ρ by averaging ρ s , in such a way that the approximate equality in (2.17) becomes an equality for ρ , and secondly then to show that ρ is itself a cocycle generated by some cross section, which will be the desired s .

Recall that, by [7, Lemma 3.67 (ii) & (iii)], for each
is a totally surjective bundle morphism, and for every c The averaging here is relative to the Haar measure on β −1 k+1 (β k+1 (c)), and is well-defined for 2 sufficiently small, thanks to (2.17) (recall Definition 2.64). By (2.18) and the fact that t > h m , we have that ρ (c) − ρ s (c) ∈ B m /B m+1 for every c ∈ C k+1 (Y). Note also that it follows clearly from (2.19) that (2.20) We shall now prove that ρ is a cocycle by showing that it inherits the required properties from ρ s thanks to the linearity of the averaging in (2.19). The required properties are the two axioms from [7, Definition 3.69]. Axiom (i) follows straight from the same property for ρ s and linearity using the fact that any set β −1 k+1 (β k+1 (c)) is globally invariant under composition with automorphisms in Aut({0, 1} k+1 ). To see the second axiom we take two adjacent cubes c 1 , c 2 ∈ C k+1 (Y) with concatenation c 3 and embed them into a (k + 2)-dimensional cube c ∈ C k+2 (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 c 1 and c 2 is the restriction of c to F 3 . Note that the existence of c is guaranteed by simplicial completion [7,Lemma 3.5]. By [7, Lemma 3.67 (iii)], we have a Haar probability on Ω = β −1 k+2 (β k+2 (c)). Then, by [7, Lemma 3.67 (iv)], the probability spaces β −1 k+1 (β k+1 (c i )), i = 1, 2, 3 are faithfully embedded as factors and coupled in the big probability space Ω. Using the concatenation property for ρ in Ω (when the random cube is restricted to F 1 , F 2 , F 3 ) and linearity of expectation we obtain that ρ (c 3 ) = ρ (c 1 ) + ρ (c 2 ).
It remains to prove that the cocycle ρ is generated by a cross section. Let ρ denote the cocycle ρ −ρ s , which takes values in B m /B m+1 (as noted just before (2.20)). It follows from (2.17) that d 2 (ρ (c), 0) ≤ 2 for every c ∈ C k+1 (Y), so for 2 sufficiently small we have that ρ is a coboundary, by Lemma 2.66. Thus for some Borel function g : Y → B m /B m+1 we have ρ (c) = σ k+1 (g • c). Hence, defining the Borel cross section s : Y → X / Bm+1 by s (y) = s(y) + g(y), we have ρ = ρ s .
By (2.20) we have that s is consistent with the factor Y t . Applying Lemma 2.75 as described above, we find the new term in the sequence S.
This completes the proof of Theorem 2.72.

Rigidity of morphisms
Given a set X, a metric space (Y, d), and maps φ, φ : X → Y , we say that φ is an -modification of φ if for every x ∈ X we have d(φ(x), φ (x)) ≤ .
Definition 2.77. Let X be a compact nilspace, and let Y be a k-step compact nilspace with a metric d generating its topology. A map φ : X → Y is a δ-quasimorphism if for every c ∈ C k+1 (X) there exists In this section we establish the following result.
Theorem 2.78. Let Y be a k-step compact nilspace of finite rank, with a metric d generating its topology.
Then for every > 0 there exists δ > 0 such that the following holds. If X is a compact nilspace and φ : X → Y is a Borel δ-quasimorphism, then φ has an -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 Z k (Lemma 2.11). We shall also use the following 'rectification result' for cubes. Lemma 2.79. Let X be a k-step compact nilspace with metric d. For every > 0 there exists δ > 0 such that the following holds. If c ∈ C k+1 (X) satisfies d π k−1 • c(v, 0), π k−1 • c(v, 1) ≤ δ for every v ∈ {0, 1} k , then c has an -modification c ∈ C k+1 (X) such that π k−1 • c (v, 0) = π k−1 • c (v, 1) for every v ∈ {0, 1} k .
Proof of Theorem 2.78. 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 > 0. Let δ > 0 be a parameter to be determined later, suppose that φ : X → Y is a δ-quasimorphism, and let φ 1 = π k−1 • φ. Then φ 1 is a δ-quasimorphism into F k−1 (Y). By induction, for some δ 1 ( ) > 0 to be fixed later, we have that if δ is small enough then φ 1 has a δ 1 -modification φ 2 : X → F k−1 (Y) that is a continuous morphism.
We shall now obtain a Borel measurable map φ 3 : X → Y that lifts φ 2 , i.e. such that π k−1 • φ 3 = φ 2 , and which is a (δ + δ 1 )-modification of φ, so that φ 3 is a δ 2 -quasimorphism with δ 2 = δ 1 + 2δ. To obtain this, the idea is first to obtain such a lift locally for each neighbourhood in some appropriate cover of X, and then combine the local lifts into a global one. To this end we use the following set: We claim that G is compact. Indeed, on one hand the map , π k−1 (y)) is continuous, and on the other hand (x, y) ∈ G if and only if Hausdorff. Hence G is closed in X × Y and therefore compact. We also claim that G is a Z k -bundle over X, where Z k is the k-th structure group of Y. Indeed, the action of Z k is given by a · (x, y) = (x, y + a), and the projection map is just (x, y) → x ∈ X.
By Proposition 2.61, the bundle G is locally trivial and so for every p ∈ X we can find an open set U p ⊂ X containing p with a continuous cross section U p → G, which must then be of the form x → (x, τ (x)) for some continuous map τ : U p → Y. Thus φ 2 (x) = π k−1 (τ (x)) for every x ∈ U p . Then, by the definition of d , since for all x ∈ U p we have in particular for p there exists z p ∈ Z k such that d τ (p) + z p , φ(p) ≤ δ 1 . But then, since the function We shall now apply an averaging argument to φ 3 that will produce a continuous morphism φ 4 which is close to φ as desired.
Let P 2 = {0, 1} k+1 \ {0 k+1 }. Note that since φ 2 is a morphism X → F k−1 (Y), it preserves k-cubes, and since φ 3 is a lift of φ 2 , by [7,Remark 3.31] we have that φ 3 also preserves k-cubes on Y. This implies that for every c ∈ C k+1 (X) the restriction of φ 3 • c to P 2 is a (k + 1)-corner on Y. For any given cube c ∈ C k+1 (X) let us denote by K 0 (c) the value at 0 k+1 of the unique completion in C k+1 (Y) of (φ 3 • c)| P2 . (2.21) We need to show that this averaging is well-defined. First note that for every c ∈ C k+1 x (X) we have , indeed since the morphism φ 2 preserves (k + 1)-cubes, and φ 3 is a lift of φ 2 , we must have K 0 (c) and φ 3 (x) both in the fibre π −1 k−1 (φ 2 (x)). Thus we need to show that if δ 2 > 0 is small enough then the set of values K 0 (c), c ∈ C k+1 x (X) has small diameter in the fibre. We will show that K 0 (c) is actually close to φ 3 (x) for every c ∈ C k+1 x (X), which will also be useful later. For any c ∈ C k+1 x (X), since In particular, this inequality holds for all v ∈ P 2 , so by the continuity of the corner-completion function (Lemma 2.12) it follows that for λ > 0, if δ 2 is small enough then we have d K 0 (c), c 0 (0 k+1 ) ≤ λ. Hence d φ 3 (x), K 0 (c) = d φ 3 • c(0 k+1 ), K 0 (c) ≤ δ 2 + λ, and we can now fix λ so that the averaging in (2.21) is indeed well-defined.
Let us now prove that φ 4 is a morphism. By [7,Lemma 3.32], it suffices to show that for every c ∈ C k+1 (X) we have φ 4 • c ∈ C k+1 (Y). We shall do this using another averaging argument, but working this time with the tricube T k+1 . Let Lemma 3.13]). If δ 2 is small enough then the following function is well defined: Indeed, by Corollary 2.35, for each v this average is equal to E c ∈C k+1 c(v) (X) K 0 (c ) = φ 4 (c(v)). Thus, we have to show that c 2 ∈ C k+1 (X). To see this, recall that for every c ∈ C k+1 . Therefore, by [7,Theorem 3.38] and the definition of degree-k extensions, we just have to check that for some (any) t 0 we have σ k+1 (c 2 − c t0 ) = 0. This follows from linearity of averaging (Lemma 2.65) and the fact that for c t , c t0 are cubes with the same projection to F k−1 (Y) for every t, so Finally, let us prove that φ 4 is continuous. The argument is similar to the proof of Theorem 2.57.
Consider the CSM structure on π 0 : C k+1 (X) → X, c → c(0 k+1 ), given by Lemma 2.30 . We have that π v is continuous and each of its restrictions to a space C k+1 x (X) is measure-preserving, by Lemma 2.27. For each v we let f v : X → L(C k+1 (X), Y) be the function sending x to the restriction of φ 3 • π v to C k+1 x (X). Then, just as in the proof of Theorem 2.57, we have that f v is continuous, by Lemma 2.50. We now want to express φ 4 in terms of the functions f v . To that end, consider again the map ξ : X → L(C k+1 (X), Cor k+1 (Y)), sending x to the function ξ x : c ∈ C k+1 Just as in the proof of Theorem 2.57, the continuity of each function f v implies that ξ is continuous. We then use again the continuous map K : L(C k+1 (X), Cor k+1 (Y)) → L(C k+1 (X), Y) that sends a function g to g • K, where K is the unique completion of (k + 1)-corners on Y. Now note that K • ξ : X → L(C k+1 (X), Y) is precisely the map that sends each x ∈ X to the function c → K 0 (c) on C k+1 x (X). This map is continuous, and by the discussion justifying the averaging (2.21), we have that in fact K • ξ takes values in the following subset of L C k+1 (X), Y : Now φ 4 is the composition of K • ξ with the averaging operator A : U → π −1 k−1 (φ 2 (x)) that sends a function g to E c∈C k+1 x (X) g(c). Thus it now suffices to show that A is continuous. Note that since π −1 k−1 (φ 2 (x)) is homeomorphic to Z k , it follows from the definition of the metric d 2 on Z k that if δ 2 + λ is sufficiently small then every function g ∈ U can be lifted continuously to a function g : C k+1 x (X) → R n , where Z k = F × T n , in such a way that two functions g 1 , g 2 ∈ U are close in the metric d 1 from (2.8) if and only if their lifts g 1 , g 2 are close in the same metric but with d now being the Euclidean distance on R n . By Lemma 2.43, if g n → g in the topology on L(C k+1 (X), Y) restricted to L(C k+1 x (X), Y) , then d 1 (g n , g) → 0, whence by the triangle inequality A(g n ) → A(g), so A is continuous as required.

Characterizing compact connected nilspaces of finite rank
Recall from [7,Subsection 3.2.4] that given a k-step nilspace X we denote by Θ i (X) the group of translations of height i on X (or i-translations). By a slight abuse of notation, when X is a compact nilspace we shall write Θ i (X) for the group of i-translations that are also continuous functions. A central goal in this section is to show that if X has finite rank then Θ i (X) is a Lie group for each i and Θ 1 (X) acts transitively on the connected components of X. This will then enable us to show that if X has connected structure groups then it can be identified with a filtered nilmanifold (Theorem 2.96).
Throughout this section we shall abbreviate 'compact and finite-rank' by writing 'cfr'.
Lemma 2.80. Let X be a cfr k-step nilspace. Then every element of Θ(X) is a homeomorphism of X preserving the Haar measure.
Proof. Each translation is an invertible continuous map from the compact Hausdorff space X to itself and so its inverse is also continuous [27,Theorem 26.6]. Moreover, the translation is a fibre-surjective automorphism of X, so it is measure preserving by Corollary 2.20.
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 → Y , with the topology induced by the uniform metric We record the following basic fact. Recall that by [7,Lemma 3.50] a translation maps every class of the relation ∼ k−1 onto another such class. This enables us to define a translation on the factor X k−1 = F k−1 (X), as in the following lemma.
Recall also that the topology on X k−1 is the quotient topology from X, which can be metrized by the quotient metric d defined in (2.2). We then denote by d ∞ the uniform metric on Θ(X k−1 ) relative to d .
Lemma 2.82. For each i ∈ N let h be the map sending each α ∈ Θ i (X) to the map h(α) on X k−1 defined by h(α)(y) = π k−1 (α(x)), for any x ∈ X such that π k−1 (x) = y. Then h is a continuous homomorphism Proof. That h is a homomorphism Θ i (X) → Θ i (X k−1 ) follows from the definitions. The continuity follows similarly, thus An important result toward our goal in this section is that if an i-translation on X k−1 is sufficiently close to the identity then it can be lifted to an i-translation on X, in the following sense.
Lemma 2.83. Let X be a cfr k-step nilspace and let i ∈ N. There exists > 0 such that if α ∈ Θ i (X k−1 ) Proof. We shall use notation from [7,Lemma 3.92]. Recall that by that lemma the translation bundle T * (α, X, i) = F k−1 (T (α, X, i)) is, from the purely algebraic viewpoint, a degree-(k − i) extension of X k−1 by Z k , and note that by the results from Section 2.1 we have that this extension is a continuous Z k -bundle.
We show first that if is sufficiently small then this extension has a measurable cross section s such that the corresponding cocycle ρ s is a coboundary.
Let γ be the projection T * (α, X, i) → X k−1 . We claim that if > 0 is sufficiently small, then we can choose a Borel cross section s : X k−1 → T * with the property that for each s(x), for every (x 0 , x 1 ) in the equivalence class π −1 k−1,T (s(x)) ⊂ T , we have d(x 0 , x 1 ) ≤ . (Recall that we have α(π k−1 (x 0 )) = π k−1 (x 1 ) for (x 0 , x 1 ) ∈ T , by [7,Definition 3.88].) Indeed, by definition d ∞ (α, id) < implies that, for each x ∈ X k−1 , there exist x 0 , x 1 ∈ X with π k−1 (x 0 ) = x, π k−1 (x 1 ) = α(x), and such that d(x 0 , x 1 ) < . Then, by 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 T * satisfies d(y 0 , y 1 ) ≤ . We choose 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 X is a locally trivial Z k -bundle over X k−1 (Proposition 2.61), we can construct s as a piecewise continuous function. Now let ρ s be the cocycle generated by s, defined for c for any lift c ∈ C k−i+1 (T * ) of c. We have that ρ s is measurable (recall the end of the proof of Lemma 2.56). We claim that, for some 2 > 0 to be fixed later, if is sufficiently small then ρ s is also small in the sense that d 2 (ρ s (c), 0 Z k ) ≤ 2 for every c ∈ C k−i+1 (X k−1 ). To show this we first give an alternative expression of the function s • c − c . The lift c , being a cube on T * , has itself a liftc ∈ C k−i+1 (T ).
The difference s • c(v) − c (v) is then the element a v ∈ Z k which has to be added toc 0 (v) in order to have φ(c 0 (v) + a v ) =c 1 (v), namely a v = φ −1 (c 1 (v)) −c 0 (v). Thus, letting a denote the function To show that this must be a small element of Z k , we argue as follows. By assumption on α, the cubec satisfies the premise of Lemma 2.79 with δ = . Thus, given 1 > 0 to be fixed later, if < 1 is sufficiently small then by that lemma there It now suffices to show that d 2 (a * (v), a(v)) ≤ 2 /2 k−i+1 for every v, for then, by virtue of c * 0 , c * 1 1 being a cube, we must have σ k−i+1 (a * ) = 0 and so σ k−i+1 (a) ≤ 2 as claimed. To show that d 2 (a * (v), a(v)) is small we can apply Lemma 2.76 with δ = 2 1 , since we know on one hand that d(c * 0 (v),c 0 (v)) ≤ 1 , and on the other hand that d(φ −1 (c 1 (v)),c 1 (v)) ≤ and d(c * 1 (v),c 1 (v)) ≤ 1 , so that d(φ −1 (c 1 (v)), c * 1 (v)) ≤ + 1 ≤ 2 1 . We can now apply Lemma 2.66. Thus if 2 is sufficiently small then there exists a Borel function g : F k−1 (X) → Z k such that ρ s (c) = σ k−1+i (g • c) for all c ∈ C k−i+1 F k−1 (X) . Let m : F k−1 (X) → T * be the measurable function x → s(x) − g(x). We have that m is a morphism, indeed for any c ∈ C n (F k−1 (X)), on one hand we clearly have that the T * -valued map m • c is a lift of c, and on the other ρ s (c) − ρ s (c) = 0, so by [7, Definition 3.68 (ii)] we have indeed m • c ∈ C n (T * ). Now [7,Proposition 3.93] gives us an i-translation β on X that is a lift of α, and is defined as follows: for each x ∈ X we have β(x) = φ(x), where φ is the local translation corresponding to the equivalence class m • π k−1 (x) ∈ T * . It only remains to check that β is Borel measurable, as then, being a morphism, it must be continuous by Theorem 2.57. By [7, Definition 3.88 and Proposition 3.90], the nilspace T is a continuous Z-bundle over T * , for the polish group Z = {(z, z) : z ∈ Z k } ≤ Z k × Z k . Therefore, arguing as in the end of the proof of Lemma 2.56, we obtain a Borel cross section λ : T * → T , and so the map λ • m • π k−1 : X → T is Borel.
We shall need a useful criterion for a translation to lie in the kernel of h. Note that if α ∈ ker(h) then, since by [7,Lemma 3.50] the restriction of α to each fibre of π k−1 is a local translation, we deduce that the map x → α(x) − x is a constant element of Z k for every x in a given fibre. Thus α induces a well-defined Conversely, given α : X k−1 → Z k we can define α : X → X, x → x + α (π k−1 (x)), and we can ask when is α in Θ(X).
Proof. By [7, Lemma 3.48] we know that α ∈ Θ i (X) if and only if for every c ∈ C n (X) we have c, α • c i ∈ C n+i (X). If α ∈ ker(h) ∩ Θ i (X) then we can take the difference α • c − c = α • c for c = π k−1 • c, and by definition of degree-k extensions this difference must be a cube in D k (Z k ). But we also have The converse follows similarly.
The next main tool that we need, Lemma 2.86 below, is a type of rigidity result for morphisms between abelian torsors of the form D k (Z). The proof will use the following basic fact.
Lemma 2.85. Let Z be a cfr abelian group, and let d 2 be the metric from Definition 2.63. Then there exists η > 0 such that for every compact abelian group Z and every non-constant continuous affine homomorphism φ : Z → Z , there exist x, y ∈ Z such that d 2 (φ(x), φ(y)) ≥ η.
Proof. We can assume without loss that φ is a homomorphism (not just an affine one). If Z is a finite group then the claim is verified by any two points x, y such that φ(x) = φ(y). We may therefore suppose that Z = F × T n with n > 0 and F a finite abelian group, and that for some i ∈ [n] the projection there is then y ∈ Z such that |π i • φ(y) − 0| T ≥ 1/4 and so with x = 0 Z we have d 2 (φ(x), φ(y)) ≥ 1/4. Lemma 2.86. Let k, ∈ N, let Z, Z be compact abelian groups, and suppose that Z has finite rank.
Proof. Since hom(D k (Z), D (Z )) ⊆ hom(D 1 (Z), D (Z )) we can assume that k = 1. Let φ be an arbitrary non-constant morphism from D 1 (Z) to D (Z ). As mentioned in [7, Example 2.18] (recall also [7, Definition 2.35]), the map φ is a polynomial map of degree at most . Thus, if for every t ∈ Z and every f : Z → Z we denote by ∆ t f the function x → f (x + t) − f (x), then there is i < and elements t 1 , t 2 , . . . , t i ∈ Z such that φ = ∆ t1 • ∆ t2 • · · · • ∆ ti φ is non-constant but ∆ t φ is constant for every t ∈ Z. It follows that φ is a non-constant continuous affine homomorphism from Z to Z , so by Lemma 2.85 there are x, y ∈ Z with d 2 (φ (x), φ (y)) ≥ η(Z ) > 0. This cannot hold if max x,y d 2 (φ(x), φ(y)) is too small, so this quantity must have a positive lower bound (depending only on Z and ). Lemma 2.86 has the following consequence.
If k = 1 then X is abelian and the result follows from Lemma 2.86. Suppose that the statement holds for k − 1. Then Lemma 2.86 tells us that φ is constant on the ∼ k−1 classes of X. This means that φ can be regarded as a function on F k−1 (X), and so by our assumption φ is constant.
To see the last sentence in the corollary, note that then by the triangle inequality φ − φ satisfies the premise of the previous sentence in the corollary, and then by that sentence and the definition of Y we deduce that φ − φ must be the constant 0.
With these results we can now give a useful description of the kernel of h. Lemma 2.88. Let X be a cfr k-step nilspace, and let h : Θ(X) → Θ(X k−1 ) be the homomorphism from Lemma 2.82. Then ker(h) is isomorphic as a topological group to F × Z k for some discrete group F . In particular ker(h) is a Lie group.
Proof. Let x ∈ X be arbitrary and let F be the stabilizer Stab ker(h) (x) = {α ∈ ker(h) : α(x) = x}. Let τ : Z k → ker(h) be the map sending z ∈ Z k to the translation τ z : x → x + z, and note that τ is an isomorphism of topological groups between Z k and τ (Z k ) ≤ ker(h). Now given any α ∈ ker(h), letting z = α(x) − x we have that α − τ z ∈ F , so ker(h) = F · τ (Z k ). Moreover, since every α ∈ 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 ker(h). We also have τ (Z k ) ker(h). (In fact τ (Z k ) ⊂ Z(ker(h)).) Using Lemma 2.84 and Corollary 2.87 we see that F is discrete. It follows that ker(h) ∼ = F × Z k as claimed. Since Z k is a Lie group, the proof is complete.
If G is a topological group then we denote the connected component of 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 2.89. Let X be a cfr k-step nilspace and let i ∈ [k]. Then the following statements hold.
(i ) Θ i (X) is a Lie group, 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 Θ i (X) is closed, we have that h(Θ i (X)) is a closed subgroup of Θ i (X k−1 ). By induction the latter is a Lie group, so by Next we show that Θ i (X k−1 ) 0 ⊆ h(Θ i (X)). (2.22) To see this we use that Θ i (X k−1 ) is a Lie group and so every element α ∈ Θ i (X k−1 ) 0 is connected to the identity by a continuous path p : [0, 1] → Θ i (X k−1 ) with p(0) = id and p(1) = α. For n ∈ N let α i = p((i − 1)/n) −1 p(i/n) for i ∈ [n] and let α = n i=1 α i . Lemma 2.83 implies that if n is sufficiently large then for every α i there is β i ∈ Θ i (X) with h(β i ) = α i . Let β = n i=1 β i . Since h is a homomorphism we have h(β) = α.
Remark 2.90. It follows from statement (ii) above that Θ i (X) 0 is a topological extension of Θ i (X k−1 ) 0 by ker(h) ∩ Θ i (X) 0 , that is we have the short exact sequence 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 [34, §2.6]).
Corollary 2.91. The Lie group Θ(X) 0 acts transitively on the connected components of X.
Proof. We argue by induction on k. For k > 0 suppose that Θ(X k−1 ) 0 acts transitively on the connected components of X k−1 . Let τ be the isomorphism Z k → τ (Z k ) ≤ Θ(X) in the proof of Lemma 2.88. Consider the group τ (Z k ) · Θ(X) 0 = {τ (z) α : z ∈ Z k , α ∈ Θ(X) 0 } ≤ Θ(X), and let M be any connected component of X. We claim that τ (Z k ) · Θ(X) 0 acts transitively on M . Indeed, for any x, y ∈ M , by Theorem 2.89 (ii) and the induction hypothesis, there exists α ∈ Θ(X) 0 such that π k−1 • α(x) = π k−1 (y). Combining this with the transitivity of Z k on the fibres of π k−1 we deduce that there exists α ∈ τ (Z k ) · Θ(X) 0 such that α (x) = y, which proves our claim. It follows that Θ(X) acts transitively on M , and we can then deduce that Θ(X) 0 also acts transitively on M by standard results (e.g. [ We then have X = X 2 a 2-step compact nilspace, X 1 = T 2 with the standard degree-1 cubes, and we compute that We also check that ker(h) = 1 Z T 1 Z 1 ∼ = Z 2 × T. Note that the structure groups of X are tori (Z 2 = T, ; thus X is also an example of the type of connected cfr nilspace to which we turn next.

Toral nilspaces
Recall that a cfr abelian group Z has torsion-free dual group if and only if Z ∼ = T n for some n ≥ 0.
Definition 2.93. We say that a k-step nilspace X is torsion-free if every structure group of X has torsion-free dual group. We call 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 (see the characteristic-0 case of [33, Definition 1.3]).
Proof. Recall the general fact that a fibre bundle is connected if the base space and the fibre are connected (see [32,Part I,§2.12]). Thus if Z has finite rank and is connected then a continuous Z-bundle over a connected space is connected. Now given a k-step toral nilspace X, with factors X i , i ∈ [k], a simple induction on i using this fact shows that X is connected.
Remark 2.95. The converse of Lemma 2.94 is false. Consider for example the connected 2-step nilspace X consisting of the circle group T with cube sets C n (G • ) for the degree-2 filtration G • with G 0 = G 1 = T and G 2 = {0, 1/2} ∼ = Z/2Z (viewing T as [0, 1) with addition mod 1). A straightforward calculation shows that x ∼ 1 y in X if and only if x − y ∈ G 2 , whence the structure group Z 2 is the disconnected group G 2 .
We can now establish the main result of this section.
Note that for the nilmanifold obtained here, every group in the filtration G • is connected. (The fact that G • 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 2.4 we have that 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, fix x ∈ X and let Γ = Stab G (x).

notes on compact nilspaces
We first claim that Γ is discrete. To see this, note that h(Γ) is a subgroup of the stabilizer of π k−1 (x) in Θ(X k−1 ), so by induction it is discrete. Then using that h −1 (h(Γ)) is a union of cosets of ker(h), we have that it suffices to show that Γ ∩ ker(h) is discrete. But this follows from Lemma 2.88, since no non-trivial element of τ (Z k ) stabilizes x.
By Corollary 2.91 the Lie group Θ(X) 0 acts transitively on the connected space X, and it follows that X is homeomorphic to the coset space G/Γ (see [18, Chapter II, Theorem 3.2]). Therefore Γ is cocompact.
It now only remains to determine the cubes on X. Recall from [7, Definition 3.54] that two cubes c 1 , c 2 ∈ C n (X) are said to be translation equivalent if there is an element c ∈ C n (G • ) such that c 2 (v) = c(v) · c 1 (v). We claim that for every cube c ∈ C n (X) there is a cube c ∈ C n (X) that is translation equivalent to the constant x cube and such that π k−1 • c = π k−1 • c . Indeed, given c ∈ C n (X), we have π k−1 • c ∈ C n (X k−1 ), and by induction the latter cube is translation equivalent to the cube with constant value x = π k−1 (x), i.e. it is of the formc · x for some cubec on the group Θ(X k−1 ) 0 with the filtration Θ i (X k−1 ) 0 i≥0 . Now by the unique factorization result for these cubes [7, Lemma 2.10], we havec =g F0 0 · · ·g F 2 n −1 2 n −1 whereg j ∈ Θ codim(Fj ) (X k−1 ) 0 . Theorem 2.89 (ii) then tells us that for each j ∈ [0, 2 n ) there is g j ∈ Θ codim(Fj ) (X) 0 such that h(g j ) =g j . Let c * be the cube in C n (Θ(X) 0 ) defined by c * = g 0 F0 · · · g 2 n −1 F 2 n −1 . Let c = c * ·x. This is in C n (X), and is translation equivalent to the constant x cube. Moreover, by construction we have This proves our claim.
It follows from [7,Theorem 3.38] and the definition of degree-k bundles [7, (3.5)] that c − c ∈ C n (D k (Z k )). But then using translations from τ (Z k ) we can correct c further to obtain c, thus showing that c is itself a translation cube with translations from Θ(X) 0 . (Such a correction procedure has been used in previous arguments, see for instance the proof of [7, Lemma 3.44].) We have thus shown that C n (X) ⊂ (C n (G • ) · Γ {0,1} n )/Γ {0,1} n . The opposite inclusion is clear, by definition of the groups Θ i (X).
To close this section we prove additional pleasant properties of toral nilspaces. In particular, statement (iii) below gives a simple relation between the translation groups and the structure groups.
Proof. We prove (i) by downward induction on i. For the case i = k, since each fibre of π k−1 is a homogeneous space of Z k , it suffices to show that Θ k (X) 0 = τ (Z k ). This is immediate from the following equality, which actually holds for a general nilspace: Θ k (X) = τ (Z k ). (2.24) To see that Θ k (X) ⊂ τ (Z k ), note first that if α ∈ Θ k (X) then we have α(x) ∼ k−1 x for all x ∈ X, for if c ∈ C k (X) is the constant-x cube, then the map α {0 k } (c) : {0, 1} k → X, equal to α(x) at 0 k and to x elsewhere, is in C k (X) (since {0 k } is a k-codimensional face), and so α(x) ∼ k−1 x (recall [7, Lemma 3.24]). Thus for each fibre π −1 k−1 (y) there exists z y ∈ Z k such that α is the map x → x + z y on this fibre. Now if y, y are distinct points in X k−1 then for any x, x in the fibres π −1 k−1 (y), π −1 k−1 (y ) respectively, note that the map c : {0, 1} k+1 → X with c(·, 0) = x and c(·, 1) = x is in C k+1 (X) (by the ergodicity and composition axioms). The map c obtained from c by changing c(0 k+1 ) to x + z y and c(0 k , 1) to x + z y is still a cube, since it is α F (c) for the k-codimensional face F = {0 k+1 , (0 k , 1)}.