Amenability, connected components, and definable actions

We study amenability of definable and topological groups. Among our main technical tools is an elaboration on and strengthening of the Massicot-Wagner version of the stabilizer theorem, and some results around measures. As an application we show that if $G$ is an amenable topological group, then the Bohr compactification of $G$ coincides with a certain"weak Bohr compactification"introduced in [24]. Formally, $G^{00}_{topo} = G^{000}_{topo}$. We also prove wide generalizations of this result, implying in particular its extension to a"definable-topological"context, confirming the main conjectures from [24]. We introduce $\bigvee$-definable group topologies on a given $\emptyset$-definable group $G$ (including group topologies induced by type-definable subgroups as well as uniformly definable group topologies), and prove that the existence of a mean on the lattice of closed, type-definable subsets of $G$ implies (under some assumption) that $cl(G^{00}_M) = cl(G^{000}_M)$ for any model $M$. We study the relationship between definability of an action of a definable group on a compact space, weakly almost periodic actions, and stability. We conclude that for any group $G$ definable in a sufficiently saturated structure, every definable action of $G$ on a compact space supports a $G$-invariant probability measure. This gives negative solutions to some questions and conjectures from [22] and [24]. We give an example of a $\emptyset$-definable approximate subgroup $X$ in a saturated extension of the group $\mathbb{F}_2 \times \mathbb{Z}$ in a suitable language for which the $\bigvee$-definable group $H:=\langle X \rangle$ contains no type-definable subgroup of bounded index. This refutes a conjecture by Wagner and shows that the Massicot-Wagner approach to prove that a locally compact"model"exists for each approximate subgroup does not work in general.

Abstract. We study amenability of definable groups and topological groups, and prove various results, briefly described below.
Among our main technical tools, of interest in its own right, is an elaboration on and strengthening of the Massicot-Wagner version [29] of the stabilizer theorem [17], and also some results about measures and measure-like functions (which we call means and pre-means).
As an application we show that if G is an amenable topological group, then the Bohr compactification of G coincides with a certain "weak Bohr compactification" introduced in [24]. In other words, the conclusion says that certain connected components of G coincide: G 00 top = G 000 top . We also prove wide generalizations of this result, implying in particular its extension to a "definabletopological" context, confirming the main conjectures from [24]. We also introduce -definable group topologies on a given ∅-definable group G (including group topologies induced by type-definable subgroups as well as uniformly definable group topologies), and prove that the existence of a mean on the lattice of closed, type-definable subsets of G implies (under some assumption) that cl(G 00 M ) = cl(G 000 M ) for any model M . Secondly, we study the relationship between (separate) definability of an action of a definable group on a compact space (in the sense of [14]), weakly almost periodic (wap) actions of G (in the sense of [10]), and stability. We conclude that any group G definable in a sufficiently saturated structure is "weakly definably amenable" in the sense of [24], namely any definable action of G on a compact space supports a G-invariant probability measure. This gives negative solutions to some questions and conjectures raised in [22] and [24]. Stability in continuous logic will play a role in some proofs in this part of the paper.
Thirdly, we give an example of a ∅-definable approximate subgroup X in a saturated extension of the group F 2 × Z in a suitable language (where F 2 is the free group in 2-generators) for which the -definable group H := X contains no type-definable subgroup of bounded index. This refutes a conjecture by Wagner and shows that the Massicot-Wagner approach to prove that a locally compact (and in consequence also Lie) "model" exists for each approximate subgroup does not work in general (they proved in [29] that it works for definably amenable approximate subgroups).

Introduction
The general motivation standing behind this research is to understand relationships between dynamical and model-theoretic properties of definable [topological] groups. More specifically, similarly to [24], in this paper our goal is to understand model-theoretic consequences of various notions of amenability.
The consequences that we consider in this paper are mainly the equalities between the appropriate versions of the connected components G 000 and G 00 of a definable group G in various categories (e.g. in the category of topological groups).
The notions of amenability are those considered in [24], and they come from certain natural categories of flows which are described below.
Let us first give some motivation for studying model-theoretic connected components of a definable group G (the definitions can be found in Section 1, or below in topological contexts). One of the main objects of interest in model theory are definable, type-definable, and, more generally, invariant sets. These contexts lead to the naturally defined connected components G 0 , G 00 , and G 000 , which yield interesting invariants G/G 0 , G/G 00 , G/G 000 of the definable group G. In an affine copy of G added as a new sort, the orbits under the action of these components are exactly Shelah, Kim-Pillay, and Lascar strong types, respectively, so any example where G 00 = G 000 yields an example of a non-G-compact theory. The component G 0 plays a fundamental role in stability theory, while G 00 takes over its role in generalizations to wider classes of theories (e.g. NIP theories). The groups G/G 0 and G/G 00 are topologically very nice (when equipped with the logic topology, where by definition the closed sets are those whose preimages under the relevant quotient map are type-definable): the former is a profinite and the latter a compact topological group (in fact, they are universal compactifications in appropriate categories). In this way, with a definable group G we associate interesting classical mathematical objects. The rather influential Pillay's conjecture (now theorem) gives more precise information about G/G 00 in an o-minimal context [19]. On the other hand, the group G/G 000 is a more mysterious, canonical object associated with the definable group G. It is a quasi-compact (so not necessarily Hausdorff) topological group, and it is Hausdorff if and only if G 00 = G 000 . In recent years, a new approach to look at G/G 000 (and more generally at Lascar (or even arbitrary) strong types) was developed, namely to measure the complexity of such quotients using Borel cardinalities in the sense of descriptive set theory (see e.g. [26,21,25]). This also involved very interesting connections with and applications of topological dynamics [25,27]. Another remark is [24,Proposition 2.18], which describes the quotient G/G 000 as a universal object (say "weak definable Bohr compactification") in a certain category. If G(M) (where M is a model) is equipped with the full structure (i.e. all subsets of all finite Cartesian powers are ∅-definable), it is a new universal object in topological dynamics, say "weak Bohr compactification" of the discrete group G(M). It may lead to an interesting extension of the class of almost periodic functions on G(M), but it has not been studied yet. These comments also apply to the connected components G 00 top and G 000 top for a topological group G. In Section 4, we clarify the connections between the equality G 00 = G 000 and definable approximate subgroups. In particular, we explain that examples with G 00 = G 000 show some limitations of the Massicot-Wagner approach to find suitable "Lie models" for arbitrary approximate subgroups. We also give an example which shows that this approach does not work in general (which is explained later in this introduction).
Below we briefly recall and explain the contexts (or "categories") which we are interested in (including the relevant notions of amenability). More detailed discussions can be found in Section 1; for the proofs the reader is referred to Section 2 of [24]. But before that, recall some issues concerning definability. A function f from a set D(M) definable in a structure M to a compact (Hausdorff) space X is said to be definable if the preimages of any two disjoint closed subsets of X can be separated by a definable set; equivalently, f is induced by a continuous map from the type space S D (M) to X. Let G(M) be a definable group. In [14], a G(M)-flow (i.e. an action by homeomorphisms of G(M) on a compact space X) is called definable if for every x ∈ X the function g → gx is a definable map from G(M) to X in the above sense. In fact, this should rather be called a separately (or elementwise) definable flow, and only for simplicity we will further write "definable flow". Recall that in the classical topological situation, if G is a topological group, then a G-flow is a jointly continuous action of G on a compact space. In the model-theoretic context of a definable group G(M), it is natural to ask, what if anything is the right analogue of a jointly continuous action on a compact space. One might want to call such an action "jointly definable". Finally, recall that an ambit is a flow with a distinguished point with dense orbit.
(1) Definable context. Here, G(M) is a group definable in a structure M. By is not in general the universal definable (jointly continuous) G(M)-ambit; it is universal but in the category of (jointly continuous) G(M)-ambits (G(M), X, x 0 ) such that the map from G to X given by g → gx 0 is definable.) (4) Weak definable [topological] amenability of a definable [resp. topological] group G(M) means that there is a left-invariant, Borel probability measure on the universal definable [resp. jointly continuous] G(M)-ambit (see Section 1). Notice that the definable topological context is a common generalization of both the definable and the topological context. We have defined above the notions of amenability in various categories by saying that the universal ambit in a given category supports an invariant, Borel probability measure. Equivalently, one can say that any ambit (or flow) in the given category supports such a measure.
The following statement is Conjecture 0.4 in [24].
Conjecture 0.1. Let G(M) be a topological group and assume that the members of a basis of neighborhoods of the identity are definable. If G is definably topologically amenable, then G 00 def,top = G 000 def,top . In the definable context described above, this conjecture specializes to the theorem (easily deduced in [24] from [29]) saying that each definably amenable group G(M) satisfies G 00 M = G 000 M . On the other hand, in the topological context, Conjecture 0.1 specializes to Conjecture 0.2 from [24] which predicts that whenever G(M) is an amenable topological group, then G 00 top = G 000 top . One of the main results of [24] [29] and [28]. As discussed above, the conjecture was proved in [29] in the definably amenable case.
In Section 4, we refute this conjecture. This shows that in order to find a "locally compact model" in general (without any amenability assumptions on the approximate subgroup X), one would have to use a completely different approach from the one involving H 00 ∅ . Observe that by compactness, if H 00 ∅ exists, then it is contained in X m for some m ≥ 1. In Section 4, we describe a quasi-homomorphism f : F 2 → Z such that for X being the graph of f computed in a sufficiently saturated elementary extension of ((F 2 , ·), (Z, +), f ) the last condition fails, and so H 00 ∅ does not exist. In fact, we show more about this example. Let H 000 ∅ be defined as the smallest invariant, bounded index subgroup of H (which always exists in a -definable group H, in contrast with H 00 ∅ ). In our example, we show that for every m ≥ 1, H 000 ∅ is not contained in X m (see Proposition 4.10).
Recall that a subset Y of H is generic if finitely many left translates of it covers X. By compactness, this is equivalent to saying that boundedly (or even countably) many translates of Y covers H. In Proposition 4.6, we will also show that the existence of m ∈ N such that H 00 H, e.g. X = H being a sufficiently saturated extension of the free group F 2 considered with the full structure) yields a family of ∅-definable approximate subgroups Y m , m ∈ N, (which are generic subsets of the definable group in question, so generate ∅-definable, finite index subgroups in finitely many steps) This paper contains the material in Sections 2, 3, and 5 of our preprint "Amenability and definability". Following the advice of editors and referees we have divided that preprint into two papers, the current paper being the first.

Some notions and definitions
We recall here the model-theoretic definitions of certain components of groups in various categories, and also the relevant variants of the notion of amenability; for more details, see Section 2 of [24]. The new notions which we introduce in this paper will appear in the relevant sections.
As usual, by a monster model of a given theory we mean a κ-saturated and strongly κ-homogeneous model for a sufficiently large cardinal κ (typically, κ > |T | is a strong limit cardinal). Where recall that the (standard) expression "strongly κ-homogeneous" means that any partial elementary map between subsets of the model of cardinality < κ extends to an automorphism of the model. A set [tuple] is said to be small [short] if it is of bounded cardinality (i.e. < κ). When G is a ∅-definable group (in the monster model) and A a (small) set of parameters, then G 00 A denotes the smallest A-definable subgroup of G of bounded index; and G 000 Let us now discuss in more details the "topological context" from item (2) a ∈ µ, g ∈ G} and µ G is the subgroup generated by µ G ); equivalently, this is the smallest normal, invariant over M subgroup of G of bounded index which contains µ.
It turns out that G 00 top is a normal subgroup of G and the map G(M) → G/G 00 top is the classical Bohr compactification of G(M) as a topological group (i.e. the universal group compactification). For a description of G/G 000 top as the initial object in a certain category see [24,Proposition 2.18]. In particular, one gets that both quotients G/G 00 top and G/G 000 top are independent as topological groups (equipped with the logic topology) of the choice of the language (provided that all open subsets of G(M) are ∅-definable) and of the choice of the monster model in which they are computed. Moreover, the closure of the identity in G/G 000 top is exactly G 00 top /G 000 top , so the property G 00 top = G 000 top is also independent of the choice of the language and the monster model.
There is also a model-theoretic description of the universal (left) G(M)-ambit as the quotient S µ G (M) := S G (M)/∼ µ , where p ∼ µ q ⇐⇒ µ · p = µ · q with the distinguished point tp(1/M)/∼ µ and the action of G(M) given by g * (µ · p) := µ · (g · p) = g · (µ · p). It is clear that this ambit is isomorphic to S µ\G (M) -the space of complete types over M of hyperimaginary elements from µ\G.
Recall the classical definition of amenability.
top . Now, we discuss in more details the more general "definable topological context" from item (3) in the introduction, which was studied in Subsection 2.2 of [24]. It is a bit subtle, so we try to be precise about the notions and definitions (although a full account is given in [24]). So we start with an L-structure M, and a group G(M) ∅-definable in M. We assume that G(M) is also a topological group, although this is not necessarily "seen" by the structure M. Let M ′ be an expansion of M in a language L ′ containing L such that we have predicates for all open subsets of the topological group G(M). Let (M ′ ) * ≻ M ′ be a monster model of Th(M ′ ) whose reduct M * ≻ M to L is also a monster model. So the dynamics of G(M) as a topological group is seen through the model theory of M ′ and (M ′ ) * as discussed earlier in this section. But we are more interested in what is definable in M. So as to avoid too much unnecessary notation, we will rather talk about M, M * and distinguish between definability in L (which we just call definable) and definability in the richer language L ′ . G 00 M and G 000 M are computed in L, and S G (M) denotes the space of complete types in the sense of L. Definition 1.4. 1) G 00 def,top := µ · G 00 M = G 00 top · G 00 M ; equivalently, this is the smallest M-type-definable (in the sense of L) subgroup of G of bounded index which contains µ.
2) G 000 def,top := µ G · G 000 M = G 000 top · G 000 M ; equivalently, this is the smallest normal, invariant over M (in the sense of L) subgroup of G of bounded index which contains µ.
Note that we need the L ′ -structure to make sense of µ, and G 00 top , etc., although G 00 def,top is nevertheless still type-definable over M in L. Observe also that all the connected components G 00 top , G 000 top , G 00 def,top , and G 000 def,top depend on M which is suppressed from the notion for simplicity (and because M is in a sense hidden in the subscript top, as the topology is given only on G(M)).
It turns out that G 00 def,top is a normal subgroup of G and the map G(M) → G/G 00 def,top is the (unique up to isomorphism) universal compactification of G(M) among definable (in the sense of L), continuous group compactifications of G(M).
Note that the definitions of G 00 def,top := µ · G 00 M and G 000 def,top := µ G · G 000 M make sense even in the wider context when L ′ is any extension of L such that all members of some basis of neighborhoods of the identity in G(M) are definable in L ′ with parameters from M (where µ is defined as the intersection of all U = U(M * ) with U(M) ranging over the definable in L ′ neighborhoods of the identity); the difference is that now more monster models are allowed, because we do not require L ′ to contain predicates for all open subsets of G. By a standard argument, we get that the quotients G/G 00 def,top and G/G 000 def,top do not depend on the choice of both the language L ′ and the monster model in which they are computed. The property G 00 def,top = G 000 def,top is also independent of the choice of L ′ and the monster model, which follows directly from definitions.
Recall that a group G(M) definable in M is definably amenable if and only if there is a left-invariant, Borel probability measure on S G (M). In order to give a suitable generalization of this notion in the "definable topological context", one needs to assume that all members of some basis of (not necessarily open) neighborhoods of the identity in G(M) are definable in M (in the original language L).
In [24], we assumed more, namely, that there is such a basis consisting of open neighborhoods of the identity, but in the more general context everything works in the same way. In particular, µ is well-defined, and S µ G (M) defined as above is still a G(M)-ambit. The following definition was proposed in [24, Section 3]. Definition 1.6. Assume that all members of some basis of neighborhoods of the identity in the topological group G(M) are definable in M (in L). We say that G(M) is definably topologically amenable if there exists a left-invariant, Borel probability measure on the G(M)-ambit S µ G (M). Conjecture 0.1 recalled in the introduction is the main conjecture of [24]. As was recalled in the introduction, one of the main results of [24]  The definition of amenability of a topological group is by saying that there is a well-behaved measure on the universal topological ambit. The definitions of definable amenability or definable topological amenability are by saying that there is a well-behaved measure on the G(M)-ambits S G (M) or S µ G (M), respectively. But these ambits are not universal in any of the categories of ambits considered in [24] (they are universal ambits in some other categories described in parentheses in items (1) and (3) in the introduction). So based on [22], we proposed in [24] more general notions of amenability, which we recall now.
As was pointed out in [22], there is a unique closed equivalence relation E on S G (M) such that S G (M)/E is the universal definable G(M)-ambit; a description of E can be found in Section 3 of [22]. In [24, Subsection 2.2], we described a closed equivalence relation E 1 on S G (M) such that S G (M)/E 1 is the universal definable topological G(M)-ambit (where G(M) is a topological group definable in M). Conjecture 0.3 from the introduction is the most general conjecture of [24]. In Section 3, we will show that it is false, even in the case when G(M) is discrete (i.e. working in the definable category). In Subsection 3.4 of [24], a weaker form of this conjecture was proposed. Namely, let G 000+ def,top be the normal subgroup generated by all products It is Minvariant, and by Proposition 3.10 of [22], we easily get that G 000 def,top ≤ G 000+ def,top ≤ G 00 def,top . Conjecture 1.8. Let G(M) be a topological group definable in an arbitrary structure M. If G is weakly definably topologically amenable, then G 00 def,top = G 000+ def,top . At first glance, it seems that this conjecture should be reachable by the methods of Section 2, but we do not quite see how to prove it.

Means and connected components
The main goal of this section is to prove the equality of various connected components under the existence of a suitable measure or mean. In particular, we will prove Conjecture 0.1. As mentioned in the introduction, this conjecture was proved in [24] but under the stronger assumption that there is a basis of open neighborhoods of the identity consisting of definable open subgroups. Similarly to [24], our proofs are based on the idea of the proof of the Massicot-Wagner version of the stabilizer lemma. Our key tricks to deal with the general case will be using means instead of measures (so something like measures but defined only on certain lattices of subsets), positively -definable sets, and a notion of largeness. As to the Massicot-Wagner result, we will prove a variant of it (see Proposition 2.11 and Corollary 2.12) which is applicable to various situations. The main results of this section are contained in Subsection 2.6. In Subsection 2.7, we study groups equipped with -definable group topologies, also proving that existence of a mean on the appropriate lattice of subsets implies equality of the closures of the appropriate connected components.
2.1. -definable sets. Let T be any (complete) theory, M |= T , and C be a monster model of T . By a [type-]definable set we usually mean a set which is [type-]definable with parameters in C. We can identify it with the corresponding formula [or set of formulas]. We will be often talking about sets which are A-typedefinable, so using parameters from a set A. One can often incorporate parameters into the language and work over ∅, e.g. in this and in the next subsection we work with ∅-definability, but sometimes parameters are essential (e.g. in Proposition 2.11 and the applications to Theorem 2.35 and Proposition 2.52).
We will now discuss the category of -positively definable sets. Although all the fundamental observations that we make are valid for the category of -definable sets, we focus on positive definability, as it is crucial in the main applications, i.e. in the proofs of Theorems 2.35 and 2.36.
By the category of -positively definable sets, we mean the category whose objects are expressions of the form i∈ω D i , where D 0 ⊆ D 1 ⊆ . . . are positively definable sets, where two such expressions are considered to be equal if they agree in any model of T (equivalently, in the monster model; so working in the monster model, any object can be identified with the corresponding subset of the model).
where i ranges over ω and j i is some index in ω, such that F i is a welldefined function, and two such collections of functions are identified if they yield the same function from i∈ω D i (M) to i∈ω E i (M) for every (equivalently, some) model M. We write i∈ω D i ⊆ i∈ω E i if this holds in every model (equivalently, in C); this is equivalent to saying that for every i there is In fact, we can consider any i∈I D i for a countable set I and positively definable sets D i , as then one can replace I by ω and the D i 's by the unions of initial sets D i , i < n. We will be doing this freely without mentioning it. Also, one could extend the context to uncountable sets I, but countable families are sufficient for the purpose of our main theorems.
Recall that a subset D of a group G is said to be (left) generic if finitely many left translates of it cover G; following [11, Definition 3.1], D is said to be thick if there is n such that for every g 1 , . . . , g n ∈ G there is i < j such that g −1 j g i ∈ D. It is clear that each thick subset of G is generic. As to the converse, if D ⊆ G is generic, then D −1 D is thick.
Let G be a group definable in T . For a positively definable set D(x,ȳ) ⊢ G(x), by (∃ gen x)D(x,ȳ) we mean the -positively definable set l∈ω (∃ l-gen x)D(x,ȳ), where (Formally, the quantifiers in the last formula are restricted to G; if (G, ·) is a sort, then this formula is clearly positive, so (∃ gen x)D(x,ȳ) is -positively definable. Abusing terminology by allowing in positive formulas both the group operation on G and quantification over G, we can say that (∃ gen x)D(x,ȳ) is -positively definable also for any definable G.) In particular, for any parametersb, For a -positively definable set D(x,ȳ) = i∈ω D i (x,ȳ) such that D(x,ȳ) ⊢ G(x) by (∃ gen x)D(x,ȳ) we mean the -positively definable set i∈ω (∃ gen x)D i (x,ȳ). In particular, for any parametersb, (∃ gen x) i∈ω D i (x,b) holds iff for some i the set Working in the monster model, this is equivalent to saying that is generic in G(C) (but this equivalence need not be true for a non ℵ 0 -saturated model).
Analogous definitions apply when we replace "generic" by "thick". The only difference is, of course, that the displayed formula above is now the following

2.2.
A largeness notion. Throughout, G is a group acting on X. We work in the language of group actions, (G, ·, X, ·, . . . ). (· refers both to the group operation and the action, and . . . to possible additional structure.) In the particular case when G acts on itself via left translations, the results which we will obtain for (G, ·, X, ·, . . . ) transfer automatically to the corresponding statements in the language of groups (G, ·, . . . ) (i.e. without the extra sort for X), just identifying X with G.
We define a largeness notion ℓ k for subsets of X, resembling "rank ≥ k" for certain model-theoretic ranks. In fact, we define two largeness notions ℓ gen k and ℓ thick k . The stronger notion ℓ thick k corresponds to non-forking in stable theories (see Remark 2.6). For our purposes, the two notions work in the same way, so later we will just write ℓ k . It would be interesting to further investigate ℓ gen k and ℓ thick k (and variants) for unstable theories.
In what follows, we deal with ℓ gen k , but everything works also for the analogously defined ℓ thick ). In particular, using terminology from Subsection 2.1, for a -positively definable set Y = Y (x) ⊆ X(x) we have a well-defined meaning of "ℓ gen k (Y ) holds" (working in a given theory). Namely, ℓ gen 0 (Y ) holds iff Y = ∅, and ℓ gen k (Y ) holds iff {g ∈ G : ℓ gen k−1 (Y ∩ gY ) holds} is generic as a -definable set, i.e. writing it as a countable increasing union of definable sets, one of them must be generic. The word "hold" will be often skipped from now on.
It is also easy to express the ℓ gen k directly, e.g. ℓ gen 3. Let L and L ′ be two languages on a given universe, expanding the language of the action of G on X.
St ℓ gen k (Y ) := {g : ℓ gen k (gY ∩ Y )}. This is an operator from the class of -positively definable sets to itself. Note that ℓ gen k+1 (Y ) holds iff St ℓ gen k (Y ) is generic as a -definable set (which remember means that writing St ℓ gen k (Y ) as a countable increasing union of definable sets U n say, one of the U n 's is generic). By Remark 2.2, we get Remark 2.4. S := St ℓ gen k (Y ) satisfies S = S −1 . If additionally ℓ gen k (Y ), then 1 ∈ S, so S is symmetric. Even more: S can be expressed by a disjunction of positive formulas (with parameters over which Y is defined) which are closed under inversion; if additionally ℓ gen k (Y ), then these formulas can be chosen to contain 1, so they are symmetric.
The next basic remark shows in particular that (working in a given theory) the -definable set ℓ gen k (Y (x,ȳ)) does not depend on the choice of the presentation of Y as a union of positively definable sets.
(2) Let Y (x,ȳ) ⊆ X(x) be a -positively definable set. Then for every k ∈ ω, In particular, if the tupleȳ is empty, then "ℓ thick k (Y ) holds" implies "ℓ gen k (Y ) holds". The whole discussion in Subsection 2.1 and above goes through working with -definable sets instead of -positively definable sets. However, the above observation that the operator St ℓ gen k preserves -positive definability will be crucial in our applications.
As already mentioned, the above definitions and facts have obvious counterparts with "generic" replaced by "thick". In the rest of the paper, we can work with any of these two versions, so we will be writing ℓ in place of ℓ gen or ℓ thick . An exception is the next remark which holds for ℓ thick .
Remark 2.6. When G = Aut(C) is the automorphism group of a monster model of a stable theory T , and Y is definable (over C), then ℓ thick Proof. Let T = Th(C). The structure in which we will be working is (G, ·, C, ·), with C equipped with its original stable structure. (←). It is enough to show this implication working in a monster model (G * , ·, C * , ·) ≻ (G, ·, C, ·). We argue by induction on k.
If Y does not fork over ∅, then Y = ∅, so ℓ thick 0 (Y ). For the induction step, consider any Y which does not fork over ∅. By inductive hypothesis, it is enough to show that S := {g ∈ G * : gY ∩ Y does not fork over ∅} is thick. Take p * ∈ S(C * ) which does not fork over ∅ and contains Y . By stability, we know that the orbit G * · p * is bounded (of cardinality at most 2 |T | ), so By stability, S ′ is a definable subset of G * (in the sense of the structure (G * , ·, C * , ·)). All of this implies that S ′ is thick, as otherwise, by the sufficient saturation of (G * , ·, C * , ·), we would get a sequence ( On the other hand, S ′ is clearly contained in S. (→). Suppose Y forks over ∅. Then, by stability, Y k-divides over ∅ for some k. Then one can easily check that ℓ thick k−1 (Y ) does not hold. We will check it for k = 2 and k = 3, leaving the general case for the reader.
Suppose Y 2-divides over ∅. Then, by the strong ℵ 0 -homogeneity of C, there are g 0 , g 1 , · · · ∈ G such that for all i < j, contradiction. (Note that this argument does not work for "generic" in place of "thick".) and for all i and j, g i g j = g i+j . Suppose for a contradiction that ℓ thick 2 (Y ) holds. Then there are i < j such that ℓ thick 2.3. Means and stabilizers. Let X be a G-set. By a G-lattice we mean a family of subsets of X including ∅ and X, which is closed under G-translations, and intersections and unions of pairs.
Given a mean m and ǫ ∈ R, the ǫ-stabilizer of a set Y ⊆ X is defined to be Lemma 2.8. Let X be a G-set and D a G-lattice. Let m be a mean on D (so m(X) < ∞), and let W ∈ D satisfy m(W ) > 0. Then: (2) We have ℓ k (W ) for all k (working in (G, ·, X, ·, W, . . . )). Proof.
(1) For some n ∈ N we have n · m(W ) > m(X). Suppose St 1 (W ) is not n-thick. Then one can find g i ∈ G, i = 1, . . . , n, satisfying g −1 (2) Let us work with ℓ = ℓ thick which clearly implies the version with ℓ = ℓ gen . Without loss, we can work in a monster model (G * , ·, X * , ·, W * , . . . ) ≻ (G, ·, X, ·, W, . . . ). To see this, apply the standard construction by incorporating m into the language (as the collection of functions m ϕ(x,ȳ) , where m ϕ(x,ȳ) (b) := m(ϕ(x,b)) when it is defined, and say symbol ∞ otherwise), extending to the monster model, and taking the standard part; this yields a mean (which we still denote by m) on a certain G * -lattice of subsets of X * , including W * , and such that m(X * ) = m(X) < ∞ and m(W * ) = m(W ) > 0. So without loss (G, ·, X, ·, W, . . . ) is a monster model.
We argue by induction on k. For k = 0, m(W ) > 0 ensures ℓ 0 (W ). For higher k, we know by induction that ℓ k−1 (gW ∩ W ) holds whenever m(gW ∩ W ) > 0. Thus, {g ∈ G : ℓ k−1 (gW ∩W )} is thick by (1), so ℓ k (W ) holds by the sufficient saturation of the model and the definition of ℓ k . (Note that ℓ k−1 (gW ∩ W ) is a -positively definable set i D i (g), so saturation is needed to deduce that {g ∈ G : D i (g)} is thick for some i.) Remark 2.9. In fact, the ideal I m = {Y : m(Y ) = 0} is an S1-ideal, i.e. I m is a Ginvariant ideal on the lattice D such that whenever W ∈ D and there are arbitrary long finite sequences (g i ) of elements of G such that g i W ∩ g j W ∈ I, then W ∈ I. The stabilizer St 1 can be defined for any S1-ideal I as {g : gW ∩ W / ∈ I}, and Lemma 2.8 continues to hold for W / ∈ I. The assumption on m ′ in Proposition 2.11 below can be replaced by: D ′ carries an S1-ideal.
Lemma 2.10. Let X be a G-set and D a G-lattice. Let m be a mean on D. Then, for any Z ∈ D and ǫ 1 , Proof. The natural argument uses symmetric differences of sets, but here our lattice is not closed under set-theoretic difference, so we will mimic means of symmetric differences. (In fact, using Proposition 2.21, we could work with the Boolean algebra generated by D and use symmetric differences, but we do not do it here to keep this argument self-contained and completely elementary.) Note that, by the invariance of m, for any ǫ we have Hence, by invariance, we easily get By ( †), it is enough to show that the left hand side of the above inequality is greater than or equal to m(g 1 g 2 Z) + m(Z) − 2m(g 1 g 2 Z ∩ Z). By the modularity of m, this is easily seen to be equivalent to m( which is true by the monotonicity of m.
The following proposition is our strong version of the Massicot-Wagner elaboration of the stabilizer theorem of the first author. It will be the engine for most of our main results. We will actually need it only in case X = G, but the more general statement clarifies some aspects of the proof. Note that when X = G, A suitable version also holds for approximate groups (yielding information on amenable approximate groups as in Massicot-Wagner), but we will stick with the global assumptions. Proof. In this proof, both largeness and -definability are considered with respect to the theory of the structure (G, ·, B). We use the mean m ′ only for the largeness of B. Namely, by Lemma 2.8, we have ℓ k (B) for all k ∈ ω. We will show: This means that if we present (using Remark 2.4) Y as n Y n with the Y n 's increasing, symmetric and positively definable over G, then some Y n is generic, and, of course, Y N n ⊆ Y N . So (**) will suffice.
We will show that any such . This proves (**).
We will also need the following corollary of the proof of Proposition 2.11.
. . , g n ∈ G}. Let D be a G-lattice containing D ′ and including A and B ′ A for B ′ ∈ D ′ . Let m be an invariant mean on D with m(A) > 0 and m(B) > 0 for B ∈ B. Then there exist l ∈ N >0 , λ ∈ R, B ∈ B, n ∈ N >0 , and g 1 , . . . , g n ∈ G such that for B ′ := B ∩ g 1 B ∩ · · · ∩ g n B we have and whenever E ∈ B and h 1 , . . . , h n ′ ∈ G (for some n ′ ∈ N >0 ) are chosen so that for The above corollary will be used later for N = 8; in [18], we will use it for N = 16.

2.4.
From pre-mean to mean. We show how to extend a pre-mean to a mean canonically; if the pre-mean is G-invariant, the resulting mean will therefore be G-invariant, too. This will be essential in the proofs of the main results of Section 2.
By a lattice of subsets of a set X we mean a family of subsets of X including ∅ and X, which is closed under intersections and unions of pairs. Definition 2.13. A normalized mean on a lattice (L, ∪, ∩) of subsets of a set X is a monotone function ρ : L → [0, 1], satisfying: and ρ(∅) = 0, ρ(X) = 1.
Whenever we present a type-definable set Z as an intersection i Z i , we mean that the Z i 's are definable, i ranges over a directed set (I, <), and Z j ⊆ Z i for i < j.
Let E = i∈I R i be a type-definable equivalence relation on a definable set X, where without loss each R i is reflexive and symmetric.
Working in the monster model, The following definition and lemma can be read over any base set of parameters.
By compactness, the condition " Lemma 2.15. Let m be a pre-mean for X/E. Then m induces a normalized mean ν on the lattice of sets Y /E, with Y a type-definable subset of X, or equivalently on the lattice of type-definable subsets Y of X with Y E = Y , in the following way and likewise for any definable subsets of D, D ′ . Hence, in this case, . Now, L is not complemented, but we do have: Letting ǫ → 0, we obtain the desired equality. Lemma 2.15 will be sufficient to deal with Case 1 in Subsection 2.6, i.e. to prove Theorem 2.35. In order to deal with Case 2 and prove Theorem 2.36, we will need some variant of this lemma. Namely, suppose that the type-definable equivalence relation E is on a definable group G.
The following variant of Lemma 2.15 follows from Lemma 2.15.
Corollary 2.17. Let m be a G-pre-mean for G/E. Then m induces a normalized mean ν on the lattice of type-definable subsets Y of G with (g 1 E∩· · ·∩g n E)•Y = Y for some g 1 , . . . , g n ∈ G, in the following way 2.5. Means and measures. In this subsection, we will prove that, in a certain general context, the existence of an invariant mean is equivalent to the existence of an invariant measure on an appropriate space. This is interesting in its own right, but also yields model-theoretic absoluteness of various notions of "amenability", i.e. the existence of invariant measures on appropriate spaces computed for a given model M does not depend on the choice of M.
Let us recall some definitions from measure theory.
Definition 2.18. Let R be a ring of subsets of a given set X, namely closed under finite unions and differences; an example is a Boolean algebra of subsets of X.
3) A measure is a pre-measure on a σ-algebra of subsets of a given set.
A content m on a ring R of subsets of X is called σ-finite if X is the union of an increasing sequence (X n ) n<ω of elements of R with m(X n ) < ∞.
Fact 2.19 (Carathéodory extension theorem). Let ν be a σ-finite pre-measure on a ring R of subsets of X. Then there is a unique extension of ν to a measure on the σ-algebra σ(R) generated by R.
From the proof, or from a more precise statement which says that the extended measure (restricted to σ(R)) is just the outer measure induced by ν, it follows that if R is a G-ring (for an action of a group G on X) and ν is G-invariant, then so is the extended measure. It is clear that the converse of the above theorem is also true, i.e. if a content ν on R extends to a measure on σ(R), then ν is a pre-measure.
When (X n ) n<ω is a descending sequence of sets whose intersection is empty, we will write X n ↓ ∅; when (X n ) n<ω is an ascending sequence of sets whose union is X, we will write X n ↑ X.
Remark 2.20. Let ν be a content on a ring R of subsets of X taking only finite values. Then ν is a pre-measure if and only if for every sequence (X n ) n<ω of sets from R such that X n ↓ ∅ one has lim n ν(X n ) = 0 (in this case we say that ν is continuous at 0). If R is a Boolean algebra, these conditions are also equivalent to the condition that for every sequence (X n ) n<ω of sets from R such that X n ↑ X one has lim n ν(X n ) = ν(X).
Proposition 2.21. If ρ is a normalized mean on a lattice (L, ∩, ∪) of subsets of a set X, then it extends uniquely to a content ν on the Boolean algebra B(L) generated by L. If L is a G-lattice and ρ is G-invariant, then so is ν.
It is clear that there is a unique possible candidate for ν, namely ν is determined by the formulas This follows by finite additivity of ρ and the fact that each element of B(L) can be (uniquely) written as a (disjoint) union of sets of the form A Conversely, it is clear that when we define ν be the above formulas on the atoms of B(L) and then extend additively, then we get a content. It is also clear that We argue by induction on n, where the base induction step for n = 0 is clear. Assume the conclusion holds for numbers less then a given n > 0. It is enough to By the modularity of ρ, , which is equal to ρ(A n ) by induction hypothesis. Thus, the induction step has been completed.
Case 2: L is arbitrary.
For uniqueness notice that any content on B(L) extending ρ is determined by its restrictions to all Boolean algebras generated by finite sublattices of L and that these restrictions are unique by Case 1. To show existence, for any finite sublattice L 0 ⊆ L let ν L 0 be the unique content on B(L 0 ) extending ρ| L 0 , which exists by Case 1. Then note that by uniqueness in Case 1, L 0 ν L 0 is the desired content.
The next easy example shows that it may happen that a mean ρ is continuous at 0, but the unique extension ν to a content on the generated Boolean algebra is not continuous at 0, i.e. ν is not a pre-measure and so it cannot be extended to a measure.
Example 2.22. Take any infinite set X and present it as an increasing union of sets X n . Let the lattice L consist of ∅, X 0 , X 1 , . . . , X. Define a mean on L by: where A n ∈ L, then eventually A n = ∅, so ρ is continuous at 0. Let ν be the unique extension of ρ to a content on B(L). Then X \ X n ↓ ∅, but lim ν(X \ X n ) = 1 2 = 0, so ν is not a pre-measure. The means we are interested in come from pre-means, and we will see that this rules out obstacles as in the above example.
From now on, we work in models of a given theory T . As is well-known, a definable family of definable sets is given by a formula ϕ(x,ȳ), in the sense that the family is precisely the collection of sets defined by the formulas ϕ(x,b) asb varies (over a given model, or over the monster model, or over all models). We generalize this to the notion of a -definable family (of definable sets), given now by a collection {ϕ i (x,z i ) : i ∈ I} of formulas. Namely, the family is {ϕ i (x,z i ) : i ∈ I,z i belongs to any model}. We call it a -definable family, as it is a union of definable families (so it can also be seen as an inductive limit of definable families).
Definition 2.23. We will say that a -definable family E := {ϕ i (x, y,z i ) : i ∈ I,z i belongs to any model} defines an equivalence relation if for every model By a standard trick, we can and do assume that I is a directed set and for every The above definition is introduced in order to capture for example the following situations. A ∅-type-definable equivalence relation E = i∈I R i (x, y) is defined by the -definable family {R i (x, y) : i ∈ I} (so here there are no parameter variables z i ). In particular, the relation of lying in the same left [resp. right] coset of a ∅-typedefinable subgroup H of a ∅-definable group G is defined by a -definable family (without parameter variables). To get another important example, consider any ∅- Then, for any model M, E M is the M-type-definable equivalence relation of lying in the same right coset of g∈G(M ) H g . More generally, when G is equipped with a -definable group topology as in Subsection 2.7, then the relation of lying in the same left [resp. right] coset of the infinitesimals (i.e. µ M from Definition 2.39) is also naturally defined by a -definable family.
From now on, let G be a ∅-definable group and let E be an equivalence relation on G defined by a -definable family E := {ϕ i (x, y,z i ) : i ∈ I,z i }; we assume that each ϕ i (x, y,z i ) implies that x, y ∈ G. Work in a monster model M * ; so G = G(M * ).
By the standard construction (by incorporating the mean into the language, as was recalled in the proof of Lemma 2.8(2)), we have the following remark.
Remark 2.25. A G-pre-mean for E M , but defined only on M-definable sets and satisfying the "equality criterion" only for g 1 , . . . , g n ∈ G(M), extends to a G-premean for E M (defined on all definable sets). In fact, it extends to a G-pre-mean for E M * , which is clearly also a G-pre-mean for E N for any N ≺ M * . If the initial From Corollary 2.17 and Remark 2.25, we get: The converse is easy is check. Proof. Put R := B(D E M ). By Remark 2.20, it is enough to show that for every sequence (X n ) n<ω of sets from R such that X n ↑ G one has lim n ν(X n ) = 1. Take any ǫ > 0. We need to show that ν(X n ) > 1 − ǫ for some n.
One can find sets Z k ⊆ Y k (for k ∈ ω) from D E M and natural numbers n 0 < n 1 < . . . such that for every i < ω (where ⊔ stands for disjoint union). Then For each k let F k be the family of all sets F definable over the set of parameters over which Z k is defined and such that Z k ⊆ F ⊆ D k . Then F k = Z k for every k. Therefore, so by the saturation of M * , there are k 1 < · · · < k n < ω and F k 1 ∈ F k 1 , . . . , F kn ∈ F kn such that (Note that this is not necessarily a disjoint union.) We also have Z k j ⊆ F k j . Since Z k j ∈ D E M , by compactness, it is easy to see that there are definable sets . . , g n ∈ G, i ∈ I, and b 1 , . . . ,b n from M (all depending on j of course). Hence, m( . From all these observations, we get The proof of the proposition is complete . The reason why we work with the more complicated lattice D E M instead of D E M is that the former is a G-lattice which is needed in Case 2 in Subsection 2.6. From Corollary 2.29 and Proposition 2.30, we get For the type-definable equivalence relation E(x, y) given by x −1 y ∈ H, where H is a ∅-type-definable subgroup of G, Corollary 2.32 specializes to  2.6. Measures, means, and connected components. Now, consider a structure M, a ∅-definable group G, and an M-type-definable subgroup H of G (naming parameters, we can assume that H is ∅-type-definable). Usually G will stand for the interpretation of G in a monster model M * (i.e. G = G * = G(M * )); by G(M) we denote the interpretation of G in M.
We will be interested in the following two cases. The discussion below repeats some arguments from the previous subsection in a special case, but since this will be the context of the main results of Section 2, we prefer to write it explicitly.
Letm be a G(M)-invariant, Borel probability measure on S G/H (M). We define a G(M)-invariant pre-mean m ′ (see Definition 2.14, where the equivalence relation is xH = yH) on M-definable subsets of G, by m ′ (Y ) :=m(Ȳ ), whereȲ is the set of complete types over M of elements of Y /H.
As in the proof of Lemma 2.8, the standard construction allows us to extend m ′ to a G-invariant pre-mean on M * -definable subsets of G = G(M * ). Note that this extended pre-mean is definable over ∅ in some expansion of the language (meaning that for any closed interval I and for any formula ϕ(x,ȳ) of the original language the set {b : m ′ (ϕ(x,b)) ∈ I} is ∅-type-definable in this expansion of the language), and M * can be chosen so that M ≺ M * in the expanded language. Next, using Lemma 2.15, we obtain a normalized, i.e. m ′ is a G-pre-mean for H\G, using the terminology from Definition 2.16 (which follows from the fact that the left translate by g of the relation Dx = Dy is precisely the relation D g x = D g y). By Corollary 2.17, we obtain a normalized, We are ready to prove the main results of this section. They concern situations from the above Cases 1 and 2, respectively. We will give a detailed proof of the first theorem and only explain how to modify it to get the second one.
In the rest of this section, we will write Z 4 to mean ZZZ −1 Z −1 ; Z 8 denotes Z 4 Z 4 . Proof. The equivalence of conditions (1)-(4) essentially follows from Proposition 2.30 applied to E := {G(x) ∧ G(y) ∧ x −1 y ∈ X i : i ∈ I}, where H = i∈I X i (with I directed and X j ⊆ X i whenever i < j). For that notice that the relation E M in this special case is just lying in the same left coset of H, so it is G-invariant, and the lattice D E M coincides with D H . However, for the reader's convenience, we explain some of these equivalences more explicitly. By the above discussion of It remains to prove (4) → (5). So assume (4). By (4) → (2) and the above discussion, we have a G-invariant mean m on D H given by m(Y ) = inf{m ′ (D) : D definable, Y ⊆ D} for some pre-mean m ′ satisfying (3).
Let p ∈ S G (M) be a wide type of G, in the sense that m(DH) > 0 for any D ∈ p. In order to finish the proof, it is enough to show that (HpH) 4 contains G 00 M . Indeed, then, since pp −1 ⊆ G 000 M implies ppp −1 p −1 ⊆ G 000 M , and so (HpH) 4 ⊆ NG 000 M , we get G 00 M ≤ NG 000 M which is the desired conclusion. As HpH is an intersection of partial types P over M satisfying HP H = P and m(P ) > 0 (namely the appropriate HDH with D M-definable), it suffices to show that for each such P , P 4 contains G 00 M . For this, it suffices to find for any M-definable set P ′ containing P a generic, M-type-definable set Q = HQH with Q 8 ⊆ P ′4 , for then m(Q) > 0 and we can find an M-definable set Q ′ containing Q such that Q ′8 ⊆ P ′4 , and we can iterate: find a generic, M-type-definable R = HRH with R 8 ⊆ Q ′4 and an M-definable R ′ containing R and satisfying R ′8 ⊆ Q ′4 , etc., and at the limit take the intersection P ′4 ∩ Q ′4 ∩ R ′4 ∩ . . . -an Mtype-definable, bounded index, subgroup contained in P ′4 , which clearly contains G 00 M . Since this is true for any M-definable P ′ containing P , we get G 00 M ⊆ P 4 . So consider a partial type P over M satisfying HP H = P and m(P ) > 0. Consider any M-definable P ′ containing P . We will apply Corollary 2.12 to: X := G, A := P , and the family B := {HQH : P ⊆ HQH ⊆ P ′ and Q is M-definable} of subsets of G. Recall that D ′ is the collection of all intersections g 1 B ∩ · · · ∩ g n B, where B ∈ B and g 1 , . . . , g n ∈ G, and as D take the G-lattice generated by: D ′ , the set A, and all sets B ′ A for B ′ ∈ D ′ . Note that D ⊆ D H , so our mean m is defined on D. By Corollary 2.12, we find l ∈ N, λ ∈ R, B ∈ B, n ∈ N >0 , and g 1 , . . . , g n ∈ G such that for B ′ := B ∩ g 1 B ∩ · · · ∩ g n B we have (***) ℓ l (B ′ ) (working in (G, ·, B)) and m(B ′ A) < λ, and whenever E ∈ B and h 1 , . . . , h n ′ ∈ G (for some n ′ ∈ N >0 ) are chosen so that for E ′ := E ∩ h 1 E ∩ · · · ∩ h n ′ E one has ℓ l (E ′ ) (working in (G, ·, E)) and m(E ′ A) < λ, then St ℓ l−1 (E ′ ) is generic (as a set -definable in (G, ·, E)), symmetric and has 8th power contained in We can find M-definable sets C and D such that B ⊆ C ⊆ P ′ , P ⊆ D and for C ′ := C ∩ g 1 C ∩ · · · ∩ g n C, we have m ′ (C ′ D) < λ (where m ′ is the premean on definable subsets of G chosen at the beginning of the proof of (4) → (5)). Now, choose any M-definable set Q such that B ⊆ Q ⊆ HQH ⊆ C. Let Q ′ = Q ∩ g 1 Q ∩ · · · ∩ g n Q. Then B ′ ⊆ Q ′ , so, by (***) and Remark 2.3, we get ℓ l (Q ′ ) (working in (G, ·, Q)). Since ℓ l (Q ′ ) is a -definable (over ∅) condition on g 1 , . . . , g n in the structure (G, ·, Q) and Q is M-definable in the original theory, we see that ℓ l (Q ′ ) is an M--definable condition on g 1 , . . . , g n in the original theory. On the other hand, m ′ (C ′ D) < λ is a -definable (over ∅) condition on g 1 , . . . , g n in the expanded language (in which m ′ is definable over ∅). Since M ≺ M * also in this expanded language, we can find g 1 , . . . , g n ∈ G(M) such that ℓ l (Q ′ ) and m ′ (C ′ D) < λ still holds for the corresponding Q ′ and C ′ . Finally, take E := HQH and E ′ := E ∩ g 1 E ∩ · · · ∩ g n E. We see that E ∈ B, ℓ l (E ′ ) (working in (G, ·, E)) and m(E ′ A) < λ.
Define Y := St ℓ l−1 (E ′ ). By the the choice of l and λ, we have that Y = ν Y ν is generic and Y 8 ⊆ E 4 ⊆ P ′4 .
Since the Y ν ⊆ G are positively M-definable in (G, ·, E) and E is M-typedefinable in the original theory, we easily get that the Y ν are M-type-definable in the original theory. Moreover, some Y ν will be generic, and HY ν H = Y ν , and Y 8 ν ⊆ P ′4 . In the situation of Case 2, we have where H = i∈I X i (with I directed and X j ⊆ X i whenever i < j). For that notice that the relation E M in this special case is just lying in the same right coset of H, so it is G(M)-invariant by the assumption that H is normalized by G(M), and the lattice D E M coincides with D ′ H . One should also use the above discussion of Case 2. It remains to justify (5) → (6). So assume (5). By (5) → (2) and the discussion of Case 2, we have a G-invariant mean m on D ′ H given by m(Y ) = inf{m ′ (D) : D definable, Y ⊆ D} for some premean m ′ satisfying (4). We follow the lines of the proof of (4) → (5) in Theorem 2.35, but now it is enough to work with right cosets modulo H g 1 ∩ · · · ∩ H gn for some g 1 , . . . , g n ∈ G(M) (in place of two-sided cosets of H), e.g. P is a partial type over M satisfying (H g 1 ∩ · · · ∩ H gn )P = P (for some g 1 , . . . , g n ∈ G(M)) and m(P ) > 0. The way how D ′ H was defined is essential to ensure that D ⊆ D ′ H (and so m is defined on D). -definable group topologies. In Section 1, we recalled two contexts to deal with topological groups model-theoretically: one with all open subsets being definable, and a more general one with a basis of open neighborhoods at the identity consisting of definable sets. Notice, however, that in each of these contexts we do not get a natural group topology when passing to elementary extensions. In order to get a group topology in an arbitrary elementary extension, one usually considers a more special context with a uniformly definable basis of open neighborhoods at the identity (in other words, when a basis of open sets at the identity is a definable family).
As usual, let G be a ∅-definable group, and M or N denotes a model. Here, we extend the last context, for example to cover topologies induced on G(M) by type-definable subgroups of G normalized by G(M). Note that any ∅-typedefinable subgroup H = i∈I X i (with the definable sets X i , where without loss I is a directed set such that X j ⊆ X i for i < j), normalized by G(M), can be viewed as topologizing G(M) in the sense that the family {X i (M) : i ∈ I} is a basis of (not necessarily open!) neighborhoods at the identity; but on a bigger model it will not in general give a topology. It is thus natural to consider a slightly stronger condition.
We first elaborate on some terminology introduced briefly in Subsection 2.5. By a -definable family of definable subsets of G, we mean a class T = {ϕ i (x,ȳ i ) : i ∈ I,ȳ i belongs to any model}, where ϕ i (x,ȳ i ) are some formulas implying G(x).
By a standard trick, we can, and will from now on, assume that I is a directed set, and for every i < j we have (∀ȳ i )(∃ȳ j )(ϕ j (x,ȳ j ) → ϕ i (x,ȳ i )); the last condition is equivalent to the property that for every model M and i < j, each member of the definable family {ϕ i (M,ȳ i ) :ȳ i ∈ M} contains a member of the family {ϕ j (M,ȳ j ) :ȳ j ∈ M}. (In fact, by the aforementioned standard trick, we could even replace the word "contains" by "equals", but we will not need it.) It easy to check that in the above definition, it is enough to take a sufficiently saturated model M.
By compactness, a -definable group topology on G is a -definable family T = {ϕ i (x,ȳ i ) : i ∈ I,ȳ i } of definable subsets of G containing 1 such that: By C T (or just C) we will denote cl(1). Then C = T , so it is ∅-type-definable, and it is a normal subgroup of G. It is clear that C ≤ µ M for any M. Note that formally C coincides with µ M * which happens to be ∅-type-definable in the monster model M * .
We 45. Note also that given a Hausdorff topological group, we can expand it to a first order structure in which there is a definable T which is strongly Hausdorff and induces the given topology on the group we started from.
Define the following G-lattices of subsets of G (a ∅-definable group equipped with a -definable group topology T ).
( Example 2.42. Let H = i∈I X i be any ∅-type-definable subgroup of G (and without loss I is directed, and X j ⊆ X i whenever i < j). Let T be the union of all families T i,m , where T i,m is the class of m-fold intersections of conjugates of X i , for instance T i,1 = {g −1 X i g : g ∈ G}. It is clear that with the order (i, m) < (j, n) ⇐⇒ i < j ∧ m < n, T can be treated as a -definable family of definable subsets of G containing 1. Clearly, for any model M, µ T M = T M is a type-definable subgroup of G normalized by G(M); it follows that T (M) defines a group topology on G(M).
In case when H is invariant under conjugation by elements of G(M), we can recover H as the intersection of all M-definable neighborhoods of the identity.
All of this works also for H type-definable over M (allowing formulas with parameters from M in the definition of -definable group topology).
In case H is a normal subgroup of G, the family T yields the same topology as the family {X i : i ∈ I} (where X i (x) are definable sets which do not depend on any parametersȳ i ), µ M = C = H does not depend on M, and cl(P ) = P H for any type-definable set P . In particular, For an arbitrary M-type-definable subgroup H, the above -definable group topology T may be strictly weaker than the one given by the normal core of H, i.e. the type-definable normal subgroup Core(H) defined by the type {(∀z)(x ∈ X z i ) : i ∈ I}. It may even happen that H is normalized by G(M), the topology on G(M) induced by H is non-discrete, whereas Core(H) is trivial and so induces the discrete topology. To give an example, one can start from the free abelian group Z, and then use suitable HNN-extensions on even steps and direct products with Z on odd steps so that the resulting group has a single non-trivial conjugacy class and the centralizer of any finite subset is non-trivial. Let M = G(M) be such a group, and G ≻ M a monster model. Let H be the intersection of the centralizers of all elements of G(M). It is an M-type-definable subgroup of G normalized by G(M). Since the intersection of any finitely many centralizers is non-trivial, the induced topology on G(M) is non-discrete. On the other hand, since in G(M), and so also in G, there is a single non-trivial conjugacy class, Core(H) coincides with the center of G which is trivial. However, the former notion, namely that of a -definable group topology is more precise, as it is a priori given without reference to the particular small model M. Also, the map from -definable group topologies to G(M)-normal, M-typedefinable subgroups (or topologies on G(M)), given by T → µ T M , is not injective; Example 2.42 provides the smallest -definable group topology specializing to a given topology on G(M), but there can certainly be others, e.g. in the Abelian case, non-discrete, strongly Hausdorff topologies are never deduced from a single model in this way (see also Example 2.45).
Remark 2.44. Let us change the notation only for the purpose of this remark. Let G be an arbitrary topological group. Choose a basis {X i : i ∈ I} of open sets at the identity, with X j ⊆ X i whenever i < j. Expand the pure group language with predicates for all X i 's, and denote the resulting structure by M and the resulting language by L. Let M * be a monster model, G * = G(M * ) and X * i = X i (M * ). Then H := X * i is a ∅-type-definable group which is normalized by G = G(M). So Example 2.42 yields a -definable group topology T which specializes to the original topology on G. This is the smallest (in a strong sense) -definable group topology which specializes to the original topology on G, namely, for any other such topology T ′ which is -definable in an expansion of the pure group structure on G whose language is denoted by L ′ , and for any model N ≻ M in the sense of L ∪ L ′ , the topology on G(N) given by T is weaker than the one given by T ′ . This shows that Example 2.42 allows us to extend the given group topology on G to the canonical (i.e. smallest among topologies -definable in arbitrary expansions) group topology on elementary extensions.
Let us look at a concrete example illustrating some of the above discussions.  It is clear that a negative answer to (1) implies a positive answer to (2). Question (2) is interesting, as it asks whether there is any chance to transfer (topological) amenability to elementary extensions. (Note that whenever we have two group topologies T 1 ⊆ T 2 on a given group G, then amenability of (G, T 2 ) implies amenability of (G, T 1 ).) As before, T = {ϕ(x,z i ) : i ∈ I,z i } is a -definable group topology on G. Along with Remark 2.41, Corollaries 2.49 and 2.50 seem to suggest that one can get (from amenability) a G-invariant, normalized mean on the lattice D T of closed, type-definable sets; but we do not quite see this. It is certainly not true about D C . To see this, it is enough to take an amenable (as a topological group) but not definably amenable group G(M) such that G is strongly Hausdorff (as then D C consists of all type-definable subsets of G = G(M * ), so the restriction of an invariant mean defined on D C to the algebra of all definable subsets would be a leftinvariant Keisler measure, contradicting the failure of definable amenability). As a concrete example with these properties one can take the group S ∞ = Sym(N) with the usual topology, considered as a group definable in a standard model (M, ∈) of a sufficient fragment of set theory.
The following is a corollary of the proofs of Theorems 2.35 and 2.36 applied for H := µ M ; the setD from the conclusion below will be p 4 := ppp −1 p −1 for a type p ∈ S G (M) which is wide in the sense that m(Dµ M ) > 0 [resp. m(µ M D) > 0] for every D ∈ p.
In fact, for any wide, M-type-definable set P = µ M P µ M we have P 4 := P P P −1 P −1 ⊇ G 00 M . The main result of this subsection is the the following Proposition 2.52. Let T be a -definable group topology such that for all n ∈ N the projections (to all subproducts) of every type-definable, closed set in G n are closed. Assume D T carries a G-invariant mean m. Then cl(G 00 M ) = cl(G 000 M ). More precisely, there exists an M-type-definable set D ⊆ G 000 M , with cl( D) = cl(G 00 M ). In fact, for any closed, wide (i.e. of positive mean), M-type-definable set P we have P 4 := P P P −1 P −1 ⊇ G 00 M . Proof. We start from Claim 1: i) The product of any two closed, type-definable sets is always closed (and clearly type-definable). ii) For all type-definable sets P and Q, cl(cl(P ) · cl(Q)) = cl(P · Q). iii) For all type-definable sets P and Q, cl(P ) · cl(Q) = cl(P · Q). iv) For every type-definable set P = P i (where P j ⊆ P i whenever i < j), cl(P ) = i cl(P i ).
Proof. i) This would follow immediately from the assumption that projections of closed, type-definable sets are closed if the topology induced by T on G = G(M * ) was Hausdorff. But if it is not Hausdorff, we can always pass to the Hausdorff quotient G/C, where C = cl(1). Working with G/C in place of G, we still have that projections of closed, type-definable sets are closed, so the product of any two closed, type-definable subsets of G/C is closed. Now, take any two closed, type-definable subsets P and Q of G. Then P = P C and Q = QC. So P/C and Q/C are closed, type-definable subsets of G/C, and so P Q/C = P/C · Q/C is closed in G/C, hence P Q is closed in G. ii) is a general property of all topological groups. iii) Using (ii), we immediately see that (iii) is equivalent to (i). iv) follows from Remark 2.40. (claim) Claim 2: For any closed, M-type-definable set P with m(P ) > 0, there exists a generic, closed set Q type-definable over some parameters and such that Q 8 ⊆ P 4 .
Proof. We use Proposition 2.11, with G = X the present G/C (where C = cl(1)), A = B = P/C, N = 8, D being the lattice of closed, type-definable subsets of G/C, and m = m ′ being the pushforward of the mean m from the statement of Proposition 2.52. (Item (i) of the first claim is used to ensure that the assumptions of Proposition 2.11 hold.) So there exists a generic, symmetricQ ⊆ G/C positively definable in (G/C, ·, P/C), and withQ 8 ⊆ (P/C) 4 . By the assumption that projections of closed, type-definable sets are closed (and the fact that G/C is Hausdorff), it follows thatQ is closed and type-definable in the original structure M * . So the pullback Q ofQ by the quotient map G → G/C is also generic, closed, type-definable, and Q 8 ⊆ P 4 .
Since we are going to deal with G 00 M , we need to be more careful about parameters, and force Q to be defined over M.
First, we will prove the last statement of Proposition 2.52, and then we will quickly explain how to deduce the previous one.
So take any closed, wide, M-type-definable set P (where wide means that m(P ) > 0). Consider any M-definable set P ′ containing P 4 .
By the first and last item of the first claim, we can find an M-definable set P ′′ such that P 4 ⊆ P ′′ ⊆ cl(P ′′ ) ⊆ P ′ . Let Q be a set provided by the second claim. We can find an M-definable, generic set Q 0 such that Q 8 0 ⊆ P ′′ , and so, by item (iii) of the first claim, cl(Q 0 ) 8 = cl(Q 8 0 ) ⊆ cl(P ′′ ) ⊆ P ′ . By the last item of the first claim, we can find an M-definable set Q 1 such that cl(Q 0 ) ⊆ Q 1 and cl(Q 1 ) 8 ⊆ P ′ . Put C 1 := cl(Q 1 ) 4 . Now, apply the above argument to cl(Q 0 ) (which is M-type-definable by Remark 2.40) in place of P , and Q 4 1 in place of P ′ . As a result, we obtain M-definable, generic sets R 0 and R 1 such that cl(R 0 ) ⊆ R 1 and cl(R 1 ) 8 ⊆ Q 4 1 . Put Continuing in this way, we obtain a sequence C 1 , C 2 , . . . of M-type-definable, generic and symmetric subsets of P ′ such that C 2 i+1 ⊆ C i for all i. Then i C i is a bounded index, M-type-definable subgroup contained in P ′ . Therefore, G 00 M ⊆ P ′ . Since P ′ was an arbitrary M-definable set containing P 4 , we conclude that G 00 M ⊆ P 4 , which is the desired conclusion.
Let us prove now the existence of D. Let p be a wide type of G over M, in the sense that m(cl(D)) > 0 for any D ∈ p. For every D ∈ p, by what we have just proved applied to P := cl(D), we have G 00 M ⊆ cl(D) 4 . Hence, by the last item of the first claim, we get G 00 M ⊆ cl(p) 4 . Put D := p 4 . It is clearly contained in G 000 M . On the other hand, by item (iii) of the first claim, cl( D) = cl(p 4 ) = cl(p) 4 ⊇ G 00 M . Remark 2.53. The assumption in Proposition 2.52 that the projections of closed, type-definable sets are closed may seem a bit artificial, perhaps it can be changed. At any rate, it holds in each of the following two situations.
(1) The situation from the last paragraph of Example 2.42, namely: H = i∈I X i is a normal, type-definable subgroup of G (and without loss X j ⊆ X i when i < j), and T := {X i : i ∈ I}.
(2) T is a definable family and (G(M), T (M)) is compact (Hausdorff) for some model M. Proof.
(1) follows from the observation that F ⊆ G n is closed if and only if F = F · C n , where C = cl(1).
(2) By the compactness and Hausdorffness of G(M), the projections of any closed subset of G(M) n are closed. Thus, since T = {ϕ(x,ȳ) :ȳ} is a definable family, we easily get that the projections of any closed and definable subset F of G n are closed. On the other hand, for any type-definable, closed set F = F i ⊆ G n (where F j ⊆ F i whenever i < j), using the last item of the first claim of the proof of Proposition 2.52, we get that F = i cl(F i ) and each cl(F i ) is definable (by the definability of T ), and, by compactness, any projection of F is the intersection of the projections of the cl(F i )'s. So the conclusion follows.
By virtue of Remark 2.53(1), the following obvious corollary of Theorem 2.35 also follows from Proposition 2.52. Corollary 2.54. Let N be any normal, ∅-type-definable subgroup of G. Assume the lattice D N (of type-definable subsets Y of G such that Y N = N) carries a G-invariant mean. Then G 00 M ≤ NG 000 M .

Definable actions, weakly almost periodic actions, and stability
One aim of this section is to give a negative answer to Conjecture 0.3 about definable actions of definable groups on compact spaces: see Corollary 3.3 below. But we go rather beyond this, discussing the relationships between the notions in the title of the section. Weakly almost periodic actions (or flows) of a (topological) group G on a compact space X are important in topological dynamics. Weak almost periodicity (for functions on a topological group) was introduced in [9], and discussed later in [16]. We will be referring to [10] where weak almost periodicity of G-flows is defined and studied. The connection of weak almost periodicity with stability is by now fairly well-known, although much of what is in print or published, such as [5] and [20], deals with the case where the relevant group G is the (topological) automorphism group of a countable ω-categorical structure. In contrast, we are here concerned with an action of a group G(M) definable in a structure M on a compact space X where G(M) is viewed as a discrete group, but where the action on X is assumed to factor through the action of G(M) on its space S G (M) of types over M.
We will give some background below on both continuous logic (in an appropriate form) and weak almost periodicity. The connection between stability in continuous logic and weak almost periodicity goes through results of Grothendieck [16] in functional analysis, which have been commented on in several expository papers such as [6] and later [33]. However, it is relative stability, namely stability of a formula in a model M which is relevant, and only equivalent to stability when the model is saturated enough.
One of our main structural results is Theorem 3.16 below characterizing when the action of G(M) on X is weakly almost periodic in terms of stable in M formulas. When M is ω 1 -saturated, another equivalent condition is that the action of G(M) on X is definable, which will yield the desired conclusions (Theorem 3.2 and Corollary 3.3).
Although this is a model theory paper, it is convenient for us to quote heavily from the topological dynamics literature, especially for results which have not yet been developed in the parallel model-theoretic environment.
We will generally be assuming any ambient theory T to be countable.
The notion of a definable action of a definable group on a compact space was given in [14] and explored in some degree of generality in [22]. We repeat the definition below. As was said in the introduction, it would be more appropriate to call it a "separately definable action", but for simplicity we are saying "definable action".
(ii) Suppose G is a group definable over M. A group action by G(M) on a compact space X by homeomorphisms is said to be definable if for every x ∈ X the map from G to X taking g to g · x is definable.
When all types over M are definable, then the natural action of G(M) on S G (M) is a definable action and is moreover the universal definable G(M)-ambit (see [14]). This is interesting for structures M such as the reals or p-adics where all types over M are definable, although the complete theories are unstable. However, in general, definability of an action of G(M) on a compact space X is a rather restrictive condition. In [22], it was shown that there is always a universal definable G(M)ambit (which will of course factor through S G (M)). Recall from Definition 1.7 that G(M) is said to be weakly definably amenable if whenever G(M) acts definably on a compact space X, then X supports a G(M)-invariant, Borel probability measure, equivalently the universal definable G(M)-ambit supports a G(M)-invariant, Borel probability measure. A special case of Conjecture 0.3 says that if G(M) is weakly definably amenable, then G 00 M = G 000 M . At the end of Subsection 3.2, we will show that this fails drastically, by proving that when M is sufficiently saturated, then G(M) is always weakly definably amenable. In fact, whenever G is a group definable in a NIP theory T and G 00 = G 000 , then choosing an ω 1 -saturated model M of T , we see from Theorem 3.2 that G(M) is weakly definably amenable. Moreover G 00 M = G 00 = G 000 = G 000 M . There are many such examples, such as from [8]: T is the theory of the 2-sorted structure M with sorts (R, +, ×) and (Z, +) and no additional structure. As pointed out there, the universal cover of SL(2, R) is naturally definable in M. T is NIP, and if G is the interpretation of this group in a saturated model, then G 00 = G 000 .

Continuous logic.
Continuous logic is about real-valued relations and formulas, or, more generally, formulas with values in compact spaces, and, as such, is present in a lot of recent work which does not explicitly mention continuous logic (even in Definition 3.1 above).
There have been various approaches to continuous logic, starting with [7]. An attractive formalism was developed in [2] and [4], and our set up will be a special case. Here, we will give relatively self-contained proofs, for reasons explained below.
T will be a complete first order theory in the usual (non-continuous) sense, which is countable (for convenience) and we work as earlier in a big saturated (or monster) model C. We fix a sort X (which will be a definable group G in the applications). As usual, M, N, . . . denote small elementary submodels of C, and A, B, . . . small subsets of this monster model. There is no harm assuming that T = T eq . Definition 3.4. (i) By a continuous logic (CL) formula on X over A, we mean a continuous function φ : S X (A) → R.
(ii) If φ is such a CL-formula, then for any b ∈ X (in the monster model) by φ(b) we mean φ(tp(b/A)). Hence, we have a map φ : X(N) → R for all models N, in particular a map φ : X = X(C) → R. As the notation suggests, we are identifying a CL-formula on X over A with the latter map, and so may write it as φ(x) where x is a variable of sort X. (iii) We consider two such CL-formulas on X, φ, ψ, over sets A, B, respectively to be equivalent if they agree in the sense of (ii), namely if for all a ∈ X, φ(a) = ψ(a).   Proof. This follows from Remark 3.5(iv).
Definition 3.8. Let φ(x, y) be a CL-formula over M.
(i) We say that φ(x, y) is stable (for the theory T ) if for all ǫ > 0 there do not exist a i , b i for i < ω (in the monster model) such that for all i < j, |φ(a (ii) On the other hand, stability of φ(x, y) in M is easily seen to be equivalent to Grothendieck's double limit condition: given a i , b i in M for i < ω we have that The following is due to Grothendieck (modulo a routine translation), and we give an explanation below. With this notation, Grothendieck's Theorem 6 in [16] says that the following are equivalent.
for which both double limits exist, which by Remark 3.9(ii) says that φ(x, y) is stable in M, namely condition (i) in the proposition.
On the other hand (ii)' implies that the closure of A in C(Z) (in the pointwise topology) is a compact, so closed, subset of the space R Z of all functions from Z to R (equipped with the pointwise, equivalently Tychonoff topology). So every function in the closure of A in R Z is already in C(Z), so is continuous. So it is clear that (ii)' is equivalent to (ii)" whenever f ∈ R Z is in the closure of A, then f is continuous.
It is now easy to see that if f ∈ R Z is in the closure of {φ(a, y) : a ∈ M}, then f is of the form φ(a * , y), where M * is a saturated model containing M, and tp(a * /M * ) is finitely satisfiable in M. So for q ∈ Z = S y (M), f (q) = φ(a * , b) for some (any) realization b of q in M * . The continuity of f means that it is given by a CL-formula ψ(y) over M, which precisely means that ψ(y) is a definition over M of tp φ (a * /M * ). So we get that (ii) implies (ii)", and it is again easy to see that they are equivalent.
Remark 3.11. (a) Actually the original statement of (ii)' in [16] is that the closure of A in the weak topology on C(Z) is compact. The weak topology on C(Z) is the one whose basic open neighbourhoods of a point f 0 are of the form {f ∈ C(Z) : |g 1 (f − f 0 )| < ǫ, . . . , |g r (f − f 0 )| < ǫ}, where g 1 , . . . , g r are in L(C(Z), R) -the space of bounded linear functions on C(Z). This weak topology is stronger than the pointwise convergence topology on C(Z) whose basic open neighbourhoods of a point f 0 are as above but where g i is evaluation at some point x i ∈ Z. It is pointed out in [16] that relative compactness of a bounded subset A of C(Z) in the weak topology is equivalent to relative compactness of A in the pointwise convergence topology, yielding the statement (ii)' in the proof of Proposition 3.10. (b) In [6], which seems to be the first model theory paper to recognize Grothendieck's contribution, only the implication "φ(x, y) stable in M implies that all φ-types over M are definable" is deduced from Grothendieck's theorem, rather than the stronger equivalence in Proposition 3.10. (c) Grothendieck's proof in [16] is basically a model theory proof. See [33] for the case of classical ({0, 1}-valued) formulas.
Proposition 3.12. The CL-formula φ(x, y) is stable (for T ) if and only if every complete φ(x, y)-type over any model over which φ is defined is definable.
Proof. In the more general metric structures formalism, this appears in [4] (Proposition 7.7 there) and adapts to our context. However, we give a relatively self contained account. Left implies right is given by Proposition 3.10. The other direction is the easy one and can be seen as follows. Assume φ(x, y) to be unstable (for a contradiction). By (or as in) Remark 3.9, we can find a i , b i ∈ C for i ∈ Q, and real numbers r < s that φ(a i , b j ) ≤ r for i < j and φ(a i , b j ) ≥ s for i > j. Let M be a countable model containing the b i for i ∈ Q over which φ is defined. By compactness, for each cut C in Q there is some a C ∈ C such that φ(a C , b j ) ≥ s for j < C and φ(a C , b j ) ≤ r for j > C. Now, by assumption, each tp φ (a C /M) is definable, so for each C there is some (ordinary) formula ψ C (y) over M such that for any b ∈ M, φ(a C , b) ≤ r implies ψ C (b), and φ(a C , b) ≥ s implies ¬ψ C (b). This is a contradiction, as there are continuum many distinct C's but only countably many (ordinary) formulas over the countable model M.
Proposition 3.13. Suppose M is ω 1 -saturated, φ(x, y) is a CL-formula over M, and every complete φ(x, y)-type over M is definable. Then every complete φ(x, y)type over any model N (over which φ is defined) is definable, and hence, by Proposition 3.12, φ(x, y) is stable.
Proof. Let A ⊂ M be countable such that φ(x, y) is over A. By Proposition 3.12 and by the proof of the right to left implication in Proposition 3.12, it suffices to prove that every complete φ-type over a countable model containing A is definable. As M is ω 1 -saturated, it is enough to prove that every complete φ-type over any countable submodel M 0 of M which contains A is definable. So let p(x) and M 0 be such. Let p ′ be a coheir of p over M, namely p ′ = tp φ (a/M), p = p ′ |M 0 , and tp(a/M) is finitely satisfiable in M 0 . By our assumptions, p ′ is definable. So to prove that p is definable it suffices to prove: Proof. Let C be a compact subset of R, and let Ψ(y, b) be a partial type over a countable sequence b from M such that for all c ∈ M, φ(a, c) ∈ C iff M |= Ψ(c, b).
We will show that in fact Ψ(y, b) is equivalent to a partial type over M 0 . For this it is enough to Ψ(y, b), as required. This finishes the proof of the claim. (claim) Hence, the proof of the proposition is also finished.

3.2.
Weakly almost periodic actions. The context here is a G-flow (X, G), where X is a compact space and G a topological group. For f a continuous function from X to R and g ∈ G, gf denotes the (continuous) function taking x ∈ X to f (gx). We will take our definition of a weakly almost periodic G-flow from Theorem II.1 of [10].  Proof. This is well-known within topological dynamics, but we nevertheless give an account with some references. We may assume that (X, G) is minimal (by passing to a minimal subflow). By Proposition II.8 of [10], the flow (X, G) is almost periodic (also known as equicontinuous). The minimal equicontinuous flows have been classified in [1] for example (see [1, Chapter 3, Theorem 6]), as homogeneous spaces for compact groups (on which G acts as subgroups of the compact groups in question), whereby the Haar measure induces the required G-invariant measure on X.
We now pass to the model-theoretic context, which here means that we consider actions of a definable group G(M) on a compact space X which factor through S G (M). But h 1 is in the pointwise closure of {gf : g ∈ G(M)}, so, by assumption, h 1 is continuous. Hence, h is continuous. By the proof of Proposition 3.10, or, more precisely, by the equivalence of (i) and (ii)" in there, the CL-formula F (xy) is stable in M, and so is F (yx) by Remark 3.9(iii). The converse goes the same way: Let f ∈ C(X), and h : X → R be in the closure, again in the pointwise topology, of {gf : g ∈ G(M)}. Let F = f • π ∈ C(S G (M)). Let h 1 = h • π. Then clearly h 1 is in the closure of {gF : g ∈ G(M)}. As F (yx) is assumed to be stable in M, by Remark 3.9(iii) and the equivalence of (i) and (ii)" in the proof of Proposition 3.10, h 1 is continuous, and so h is continuous.
So far we have shown (i) if and only if (ii). We now show that either of these equivalent conditions imply that the action of G(M) on X is definable. Let x 0 ∈ X. Proof. Let p ∈ S G (M) be such that π(p) = x 0 . Consider the lift F of f to S G (M) via π. We use x, y to denote variables of sort G. By (ii), the formula F (yx) (in variables x, y) is stable in M, so, by Proposition 3.10, the function taking g ∈ G(M) to F (gp) is definable over M, namely induced by a CL-formula ψ(y) over M. But F (gp) = f (gx 0 ). Hence, the claim is proved. (claim) Definability of the action of G(M) on X now follows from the claim and Urysohn's lemma: Let X 0 , X 1 be disjoint closed subsets of X. By Urysohn, there is a continuous function f ∈ C(X) such that f is 0 on X 0 and 1 on X 1 . By the claim, there is some definable (in M) subset Z of G(M), such that for all g ∈ G(M), if f (gx 0 ) = 0 then g ∈ Z, and if f (gx 0 ) = 1 then g / ∈ Z. But this implies that if gx 0 ∈ X 0 then g ∈ Z, and if gx 0 ∈ X 1 then g / ∈ Z. As x 0 ∈ X was arbitrary, this shows that the action of G(M) on X is definable.
(b) We assume now that M is ω 1 -saturated. All we have to do is to prove that (iii) implies the stronger version of (ii) (with stability for T ). Now, exactly as in the previous paragraph, definability of the action of G(M) on X means precisely that whenever F : S G (M) → R lifts some continuous function f on X, then every complete F (yx)-type over M is definable. By Proposition 3.13, each such F (yx) is stable (for T ).
Proof of Theorem 3.2. We may assume that X is a (definable) G(M)-ambit, in which case, by [14] or [22,Remark 3.2], the action factors through the action of G(M) on S G (M). By Theorem 3.16(b), and ω 1 -saturation of M, the action of G on X is wap, so, by Fact 3.15, X has a G(M)-invariant, Borel probability measure.
3.3. On universal ambits and minimal flows. We give a description of the universal definable wap ambit and universal minimal definable wap flow for a group G(M) definable in a structure M. As seen by the material above, this is closely connected to stable group theory in the continuous logic sense, but unless M is saturated enough, it will be stability in M. Actually, even in the classical case, stable group theory relative to a model M (i.e. where relevant formulas φ(x, y) are stable in M) has not been written down, so it is not surprising if we happen to rely on the topological dynamical literature. By G we mean G(M * ) for a suitably saturated elementary extension M * of M.
M will be an arbitrary structure and G(M) a group definable in M. Following on from notation in the previous section, if F (x) is a CL-formula on G (i.e. where the variable x ranges over G) over M, then we will call F stable in M if the CLformula F (yx) (in variables x, y) is stable in M. Let A be the collection (in fact algebra) of such stable in M, CL-formulas F (x) on G. Let S be the quotient of S G (M) by the closed equivalence relation ∼ A given by p ∼ A q ⇐⇒ (∀F ∈ A)(F (p) = F (q)).
S is naturally a compact space which we call the type space over M of the stable in M, CL-formulas over M. Let π 0 : S G (M) → S be the canonical surjective continuous map. Note that G(M) acts on S, and that π 0 is a map of G(M)-flows (in fact ambits, where π 0 (e) is taken as the distinguished point of S). With the above notation we have: Proof. This follows from the Stone-Weierstrass theorem and the easy fact that A is a closed subalgebra of the Banach algebra C(S G (M)) of all real valued continuous functions on S G (M) (where C(S G (M)) is equipped with the uniform convergence topology). (claim) We can also give a description of the universal definable G(M)-ambit for an arbitrary (not necessarily ω 1 -saturated) M. For this recall that in the proof of Theorem 3.16 (Claim 1 and the paragraph afterwards; see also the proof of (b)) we showed that definability of the action of G(M) on X means precisely that whenever F : S G (M) → R lifts some continuous function f on X, then every complete F (yx)-type over M is definable. Thus, applying Stone-Weierstrass as in the proof of Claim 1 in the proof of Proposition 3.17 and following the lines of the easy proof of item (i) of this proposition, we get

Approximate subgroups and connected components
As discussed in the introduction, the main goal here is to refute Wagner's conjecture on the existence of H 00 ∅ for H := X , where X is an approximate subgroup 1 (in a monster model). We also clarify connections between approximate subgroups and the equality H 00 ∅ = H 000 ∅ . 4.1. Connected components and thick sets. We work in a monster model C of a first order theory T , By a -definable group we mean a group (H, ·) of the form H n , where (H n ) n<ω is an increasing union of definable sets, and · : H n × H n → H n+1 and −1 : H n → H n are definable for every n. We will be interested in the special case where G is a ∅-definable group, X a ∅-definable approximate subgroup, and H := X ; so here we can take H n := X 2 n . Note that, by compactness, a definable subset of H is always contained in some power of X.
Recall Recall that a definable subset D of H is generic if finitely many left translates of D by elements of H cover X. As X is an approximate subgroup, D being generic is equivalent to any of the conditions: (1) for every n finitely many left translates of D cover X n , (2) every definable subset of H is covered by finitely many left translates of D,  pair (a, b) can be extended to an infinite indiscernible sequence. It is well-known and easy to check that the transitive closure of Θ is the finest bounded, invariant equivalence relation on C. This relation is said to be the relation of having the same Lascar strong type and is denoted by E L . It is also clear that for any invariant subset Y of C, the relation E L restricted to Y is the finest bounded, invariant equivalence relation on Y , and that it is the transitive closure of the relation Θ restricted to Y . Now, in the context of our H = X , which is clearly invariant, we easily get that H 000 ∅ exists and is exactly the group generated by the set P := {a −1 b : a, b ∈ H and aΘb}. Proof. The group P is clearly invariant and of bounded index, because the induced relation of lying in the same left coset is coarser than E L (restricted to H). And, on the other hand, for every bounded index, invariant subgroup K of H the relation of lying in the same left coset of K is bounded and invariant so coarser than E L , and hence a −1 b ∈ K for every a, b ∈ H with aΘb. Thus, P is indeed the smallest invariant subgroup of K of bounded index, which is H 000 ∅ by definition.
Proof. Let P X := {a −1 b : a, b ∈ X and aΘb}. The inclusion P ⊇ P X is obvious.
For the opposite inclusion, consider any a, b ∈ H with aΘb. We need to show that a −1 b ∈ P X . Since X is a generic subset of H, we can find a countable C ⊆ H with CX = H. Let (a i ) i<ω be an indiscernible sequence such that a 0 = a and a 1 = b. By a standard application of Ramsey theorem and compactness, we can find a sequence (a ′ i ) i<ω which is indiscernible over C and has the same type over ∅ as (a i ) i<ω .
By indiscernibility over C and the choice of C, there are c ∈ C and an indiscernible sequence (a ′′ i ) i<ω of elements of X such that a ′ i = ca ′′ i for all i < ω. Then a ′−1 0 a ′ 1 = a ′′−1 0 a ′′ 1 ∈ P X . Since P X is clearly invariant and a ′−1 0 a ′ 1 ≡ a −1 0 a 1 , we get that a −1 0 a 1 ∈ P X , i.e. a −1 b ∈ P X . The "in particular" part is now clear, as P X is easily seen to be ∅-type-definable and, of course, P is symmetric. Proof. (⊆) Take α ∈ P , i.e. α := a −1 b for some a, b ∈ H starting an infinite indiscernible sequence a 0 = a, a 1 = b, a 2 , . . . . Consider any ∅-definable, thick subset D of H. By compactness, we can extend (a i ) i<ω to an unbounded indiscernible sequence (a i ) i<κ . Then there are i < j such that a −1 i a j ∈ D, and so α = a −1 0 a 1 ∈ D by invariance of D.
(⊇) By Lemma 4.4, P is a ∅-type-definable, symmetric subset of H, so it can be written as the intersection of a family {D k } k of ∅-definable, symmetric subsets of H.
Observe that there is no unbounded sequence (a i ) i<λ of elements of H such that a −1 i a j / ∈ P for all i < j < λ. Otherwise, by extracting indiscernibles, there is an unbounded indiscernible sequence (a ′ i ) i<κ with (a ′ 0 , a ′ 1 ) ≡ (a i , a j ) for some i < j. Then all a ′ i are in H and a ′−1 0 a ′ 1 / ∈ P , a contradiction with the definition of P . Thus, for every k, the set D k is thick. So the intersection of all ∅-definable, thick subsets of H is contained in P .
For completeness note that whenever H 00 ∅ exists, then H 000 ∅ ≤ H 00 ∅ . 4.2. Equivalent conditions. Let X be a ∅-definable approximate subgroup (in a ∅-definable group G), everything in a monster model. As before, H := X . Let m ≥ 1. We are interested in the following conditions: The property (∃m)(⋄⋄) m was crucial in [29] to find a "locally compact model" for X under the definable amenability assumption, and in [24] as well as in Section 2 of this paper to prove the appropriate variants of the equality H 000 ∅ = H 00 ∅ in the case when H is definable and satisfies various kinds of amenability assumptions.
Here, we prove is type-definable. On the other hand, by Propositions 4.3 and 4.5, we know that H 000 ∅ = P and P is typedefinable and symmetric. Therefore, by [32, Theorem 3.1], we get that H 000 ∅ = P k for some k ≥ 1. We will show that (⋄⋄) 2k holds.
So take any ∅-definable, generic, symmetric subset Y of H. Then Y 2 is thick. Hence, P ⊆ Y 2 by Proposition 4.5. Thus, P k ⊆ Y 2k , i.e. H 00 ∅ ⊆ Y 2k by the previous paragraph.
(3) → (1). Let m ≥ 1 be such that (⋄ ⋄ ⋄) m holds. Then, by Proposition 4.5, compactness, and the fact that the class of thick subsets of H is closed under finite intersections, we get H 000 Let F 2 be the free group with the free generators a and b. Let α, β ∈ l ∞ odd (Z), where l ∞ odd (Z) is the set of bounded, odd, integer valued functions on Z. Let f : F 2 → Z be given by f (a n 1 b m 1 . . . a n k b m k ) := k i=1 α(n i ) + β(m i ), where n i = 0 for 1 < i ≤ k and m i = 0 for 1 ≤ i < k. By [34,Proposition 4.1], f is a quasi-homomorphism. Let us choose α which is non-zero for almost all arguments n ∈ Z. For example, one can take α = β := sgn, where sgn(n) is 1 if n is postive, −1 if n is negative, and 0 if n = 0; then the fact that the resulting f is a quasi-homomorphism follows from [34, Proposition 2.1]. Let F be the graph of f . It is an approximate subgroup in F 2 × Z.
Let M be the two-sorted structure with the sorts being the pure groups (F 2 , ·) and (Z, +) together with the above function f : F 2 → Z (or any expansion of this structure). Then F is ∅-definable in M. We will be working in a monster model M * ≻ M. Let F * := F (M * ) (i.e. the interpretation of F in M * ), and similarly we have F * 2 , Z * , and f * . Then f * : F * 2 → Z * is clearly a quasi-homomorphism for which f * ′ has the same finite image as f ′ , and F * is the graph of f * and so a ∅-definable approximate subgroup in F * 2 × Z * . To be consistent with the notation from previous subsections, let us denote F * by X, and put H := X . We will be using the set P defined and considered in Subsection 4.1. Proof. Suppose for a contradiction that H 000 ∅ ⊆ X m for some m ≥ 1. For B ⊆ Z and n ∈ N, let B +n := B + · · · + B be the n-fold sum. Note that ( * ) X m ⊆ {e} × Im(f ′ ) +(m−1) X.
Consider any ∅-definable, thick subset D of H. Let π 1 : F * 2 × Z * → F * 2 be the projection. By thickness of D and Remark 4.2, there are infinitely many k ∈ N with a k ∈ π 1 [D]. So, by the definition of f and the assumption on α, we can find k ≥ 1 such that a k ∈ π 1 [D] and f (a k ) = 0 and f ((a k ) n ) ∈ Im(α) for all n ∈ Z.
Similarly, we can find l = 0 such that b l ∈ π 1 [D] and f ((b l ) n ) ∈ Im(β) for all n ∈ Z.
Since f (a k b l ) = 0 or f (a k b −l ) = 0, replacing l by −l if necessary, we can assume that f (a k b l ) = 0.
By the definition of f and the fact that k, l = 0, we also have f ((a k b l ) n ) = nf (a k b l ) for all n ∈ Z.
Using the last four displayed conditions, the assumption that Im(α) and Im(β) are finite, Proposition 4.5, the fact that the class of thick subsets of H is closed under finite intersections, and compactness, we can find s, t ∈ F * 2 and ǫ, δ ∈ Z * such that: ( * * )    (s, ǫ) ∈ P and f * (s) = 0 and f * (s n ) ∈ Im(α) for all n ∈ Z, (t, δ) ∈ P and f * (t n ) ∈ Im(β) for all n ∈ Z, f * (st) = 0 and f * ((st) n ) = nf * (st) for all n ∈ Z.
Corollary 4.11. H 00 ∅ does not exist. As mentioned in the introduction, by [28,Corollary 5.14], this implies that H 00 C does not exist for any small set of parameters C and even working with any expansion of the structure M. But in our particular example this also follows from our proof above, where the assumption that C = ∅ and the choice of the structure expanding M are irrelevant.

Final remarks
5.1. Connected components and approximate subgroups. Let us work here over a small model M (as a set of parameters), i.e. definability is over M. Let G be a definable group, and X a definable approximate subgroup; put H := X . In this context, and under various auxiliary amenability-type hypotheses, one proves the "stabilizer theorem" ( †) H 00 M ⊆ X 4 . This leads to a connection with locally compact groups L, and through them Lie groups. (See [17], [30], [35], and most relevant to us [29].) In Section 4, we gave an example showing that in general ( †) may drastically fail, namely H 00 M need not exist, which refutes Wagner's conjecture (i.e. [28,Conjecture 0.15]). In [29], Massicot and Wagner conjectured that "even without the definable amenability assumption a suitable Lie model exists". Our counter-example shows that in order to find such a model, one should use different methods (i.e. not involving H 00 M ). In Sections 2 and 3 of this paper, we have restricted to the case where thedefinable group H is actually definable. In this case, the locally compact group L is compact. This case is not ruled out as trivial, and indeed is of considerable interest; for instance some of the first theorems in this line, by Gowers and Helfgott, asserted in effect that generic definable subsets of certain pseudofinite groups generated the group in boundedly many steps (3 or 4), and were in turn important in further developments by Bourgain-Gamburd and many others.
Let us briefly discuss a connection between ( †) (or rather (∃m)(⋄⋄) m from Section 4) with the main results of this paper. In the proof of Theorems 2.35, 2.36, and 2.52, we showed that under an appropriate amenability assumption and for suitable sets X we have G 00 M ⊆ X 4 , from which we easily deduced the appropriate variants of the equality G 00 M = G 000 M . This general idea was first used in [24] under the full definable amenability assumption of G (where G 00 M ⊆ X 4 for any definable, generic and symmetric X was easily deduced from [29]). Also in [24], this idea was extended to some situations when an invariant probability measure is available only on a suitable subalgebra of the Boolean algebra of all definable subsets of G. A similar observation (i.e. a version of the "stabilizer theorem" assuming a measure on a suitable subalgebra) appeared also in [28]. In order to prove the above main results of this paper, we essentially extended this idea. This required a more precise version of the "stabilizer theorem", using -positively definable sets. The key application of positive definability appears in the last paragraph of the proof of Theorem 2.35, where we used positive M-definability in (G, ·, E) of a certain set Y ν produced by our version of the "stabilizer theorem", where E is M-type-definable in the original structure, to deduce that Y ν is M-type-definable in the original structure. Alternatively, to prove the implication (4) → (5) in Theorem 2.35, one could use the version of the "stabilizer theorem" established in [28,Corollary 4.14], and then, instead of positive definability, use [28, Theorem 5.2] whose proof involves a variant of Beth's theorem and a new version of Schlichting's theorem. The two approaches (i.e. Massicot's based on Schlichting's theorem and ours using positive definability) are different and were developed independently.

5.2.
Connected components and complexity. Let us consider these notions from the point of view of descriptive set theory (see for example [31] for the terms below.) Fix a countable language L with distinguished sort G (with a binary operation), and consider the space of complete theories T (with G a group). For now, G 000 etc. will mean G 000 ∅ etc. The condition G = G 000 is at the finite level of the Borel hierarchy ("arithmetic"), and is in fact a countable union of closed sets. This can be seen as follows. First, it