{'fraction_non_alphanumeric': 0.06425870387273439, 'fraction_numerical': 0.016612335376189856, 'mean_word_length': 3.2835120643431637, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 47, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Hausdorff dimension in a family of self-similar groups

For each prime p and a monic polynomial f, invertible over p, we define a group G_{p,f} of p-adic automorphisms of the p-ary rooted tree. The groups are modeled after the first Grigorchuk group, which in this setting is the group G_{2,x^2+x+1}. We show that the constructed groups are self-similar, regular branch groups. This enables us to calculate the Hausdorff dimension of their closures, providing concrete examples (not using random methods) of topologically finitely generated closed subgroups of the group of p-adic automorphisms with Hausdorff dimension arbitrarily close to 1. We provide a characterization of finitely constrained groups in terms of the branching property, and as a corollary conclude that all defined groups are finitely constrained. In addition, we show that all infinite, finitely constrained groups of p-adic automorphisms have positive and rational Hausdorff dimension and we provide a general formula for Hausdorff dimension of finitely constrained groups. Further ``finiteness'' properties are also discussed (amenability, torsion and intermediate growth).


Introduction
The group known as the first Grigorchuk group was constructed in [9] as a particularly simple example of a finitely generated infinite torsion group (Burnsde group) and has since provided solutions to several outstanding problems in mathematics. For example, this group was the first example of a group of intermediate growth [10,11] and the first example of amenable but not elementary amenable group [11]. It served as a prime example and inspiration leading to the definition of many important classes of groups, such as branch groups, self-similar groups, finitely constrained groups, groups with L-presentations, groups generated by bounded automata, contracting groups, and so on (for more details see [14,4,5,21,15,20]).
There have been some generalizations, such as those in [11,12] as well as the so called spinal groups in [6,5]. However, even as the family of groups of Grigorchuk type grew, the apparent simplicity and symmetry of the first example has not been repeated (perhaps with the exception of the Gupta-Sidki example [19], which actually has its own interesting properties, and forms a basis for another family of interesting examples). One of the purposes of this article is to explicitly construct, for each prime p, groups that resemble the original example as much as possible. In a sense, we are after siblings of the first Grigorchuk group, not just some distant relatives. In what follows, one group G p,f will be constructed for each prime p and each monic polynomial f , invertible over p, of degree m ≥ 2. In this setting, the Grigorchuk group is the group G 2,x 2 +x+1 , defined by the smallest possible prime p = 2 and the unique primitive polynomial over GF (2) of the smallest possible degree m = 2. We will show that all constructed examples are self-similar, regular branch groups and we will exhibit their branching structure (Theorem 1).
Abért and Virág showed in [1] that the closure of a group of p-adic tree automorphisms of the p-ary rooted tree generated by three randomly chosen automorphisms has Hausdorff dimension 1 with probability 1. However, no concrete examples of topologically finitely generated closed groups of p-adic automorphisms of Hausdorff dimension 1 are known. The branching structure of G p,f enables us to show that G p,f , defined by a polynomial f of degree m ≥ 2, has Hausdorff dimension 1−t/p m+1 , where t = p, when p = 3, and t = 3, when p = 2 (Theorem 2). Thus, for any prime p, we have concrete examples of topologically finitely generated closed subgroups of the group of p-adic automorphisms with Hausdorff dimension arbitrarily close to 1.
Finitely constrained groups were introduced by Grigorchuk in [15] (under the name "groups of finite type"), where it is shown that the closure of the first Grigorchuk group in the group of automorphisms of the binary tree is an example of such a group. In the same work ( [15], Proposition 7.5) Grigorchuk showed that the finitely constrained groups are always closures of self-similar, regular branch groups, branching over some level stabilizer. We provide a converse to this claim, thus characterizing finitely constrained groups in terms of their branching structure (Theorem 3). This immediately implies that the groups constructed here are finitely constrained groups. Moreover, we show that every infinite, finitely constrained group of p-adic automorphisms has positive and rational Hausdorff dimension and provide a general formula for the Hausdorff dimension of finitely constrained groups (Theorem 4). This provides partial answers to Problem 7.1.(ii) and Problem 7.1.(iii) from [15].
At the very end, we discuss some further properties of the constructed groups, such as amenability, torsion and growth. In particular, we characterize those examples that are p-groups (Proposition 9).

Self-similar groups
We provide a quick and informal introduction to the notion of a self-similar group.
Let X be a finite alphabet. Our choice of a standard alphabet on k letters is X = {0, 1, . . . , k − 1}. The set X * of all finite words over X can be given the structure of a k-ary rooted tree. The empty word ∅ is the root, the set of words X n of length n constitute level n in the tree and each vertex u on level n has k children, namely ux, x ∈ X. The group of tree automorphisms of the tree X * is denoted by Aut(X * ).
The decomposition (2) describes (decomposes!) the action of g on X * as follows.
The tree automorphisms g x , x ∈ X, act on the subtrees xX * , x ∈ X, and then the permutation π g ∈ Sym k permutes these subtrees. The permutation π g is called the root activity of g and the automorphisms g x , x ∈ X are called (the first level) sections of g. The notion of a section can be extended to any vertex, recursively by g ∅ = g, g ux = (g u ) x , for u a word over X and x a letter in X. The notion of activity is also extended to all vertices by declaring that the root activity of the section g u is the activity of g at the vertex u. The section of g at u is the unique tree automorphism g u such that for all w in X * . Thus, the section g u describes the action of g on the tails of words that start in u. In particular, the decomposition (2) indicates that the action of g on the tree X * is recursively given by for x a letter in X and w a word over X.
For a group of tree automorphisms G ≤ Aut(X * ), denote by G n the stabilizer of level n. Denote by X [n] the finite subtree of X * consisting of levels 0 through n in X * . The quotient Aut(X * )/Aut(X * ) n is canonically isomorphic to the group Aut(X [n] ) of tree automorphisms of the finite k-ary tree X [n] . The group Aut(X * ), being the inverse limit of the finite groups Aut(X [n] ) = Sym k ≀ Sym k ≀ · · · ≀ Sym k n , is a pro-finite group. A natural metric on Aut(X * ), derived from the filtration of Aut(X * ) by its level stabilizers, is defined by Thus, the distance directly depends on the number of levels on which f and g agree. Of particular interest is the group of p-adic automorphisms, for p a prime number. Let π = (0 1 . . . p − 1) be the standard cycle on X = {0, . . . , p − 1}. A p-adic automorphism g is an automorphism of the p-ary rooted tree such that the activity of g at any vertex is a power of the cyclic permutation π. The group of all p-adic automorphisms is denoted by A(p). It a pro-p-group isomorphic to the infinitely iterated wreath product C p ≀ C p ≀ . . . . The group A(p) is clearly self-similar. As an example of a p-adic automorphism, define This automorphism just rigidly permutes all the subtrees on the first level of X * . i.e., it only affects the first letter in each word. The group A(p) of p-adic automorphisms is a closed subgroup of the group of automorphisms of the p-ary tree and, as such, it inherits the metric from Aut(X * ). However, it is customary to work with the natural metric derived from the filtration of A(p) by its own level stabilizers and defined by Note that, when p = 2, there is no difference between automorphisms and 2-adic automorphisms, i.e., Aut({0, 1} * ) = A(2). Let G be a group of tree automorphisms. For a vertex u, the map ϕ u : G u → Aut(X * ) mapping each element of the vertex stabilizer G u of u in G to its section g u at u is a homomorphism. The map ψ : G 1 → Aut(X * ) × · · · × Aut(X * ) defined by ψ(g) = (ϕ 0 (g), . . . , ϕ k−1 (g)) is also a homomorphism.
A group G of tree automorphisms is self-replicating if ϕ(G u ) = G, for every vertex u in X * .
A group G of tree automorphisms acts spherically transitively on X * if it acts transitively on each level of X * .

Examples
We start with the standard definition of the first Grigorchuk group as a selfsimilar group of automorphisms of the binary tree (equivalently, as a group of 2-adic automorphisms). Then we observe some basic elements of the construction, which lead us to the definition of groups associated with maps between finite vector spaces. A natural faithfulness condition then leads to the definition of a single group G p,f for each prime p and a monic polynomial f , invertible over p.
The first Grigorchuk group is the self-similar group G = a, b, c, d of tree automorphisms generated by the automorphisms a, b, c, and d defined by  Similarly, the definition of the left sections ϕ 0 (b) = a, ϕ 0 (c) = a, ϕ 0 (d) = 1 corresponds to the surjective homomorphism ω : B → A defined by Let p be a prime, A and B be the abelian groups Z/pZ and (Z/pZ) m , respectively, in multiplicative notation. When convenient, we also think of A as the field on p elements and of B as the m-dimensional vector space over this field. Let ρ : B → B be an automorphism of B (an invertible linear transformation on the m-dimensional vector space B) and ω : B → A a surjective homomorphism (nontrivial functional on B).
Let A = a and let a act faithfully on the p-ary rooted tree as the p-adic automorphism defined in (3). Let the action of b ∈ B on X * be recursively defined by b = (ω(b), 1, . . . , 1, ρ(b)).
The action of b is illustrated in Figure 2.
l l l l l l l l l l l w w w w w w w w q q q q q q q q q q q q q q q q q ω(ρ 2 (b)) . . .
Since each section of a generator of G ω,ρ is another generator or is trivial, the defined groups are self-similar. We will not emphasize this approach, but it is also clear that each group G ω,ρ can be defined by a finite automaton (see [13] for definition).
We now observe that different pairs (ω, ρ) may define the same group.
Proposition 1. Let α : A → A and β : B → B be automorphisms such that the following diagram commutes: Then G ω1,ρ1 = G ω2,ρ2 as subgroups of A(p).
Proof. The automorphism α is just a power automorphism given by α(x) = x k for some fixed k = 1, . . . , p − 1 (in vector space terminology, α is multiplication by the non-zero scalar k). Define α ′ : B → B to be the corresponding power automorphism of B, given by α ′ (x) = x k . Then αω 1 = ω 1 α ′ and α ′ ρ 1 = ρ 1 α ′ and, for b ∈ B, the automorphisms β(b) in G ω2,ρ2 and α ′ (b) in G ω1,ρ1 are the same automorphism of X * . The latter is clear from the fact that Thus in concrete examples we may always choose a conjugate representative of ρ. For example, we may replace a given group G ρ2,ω2 by G ρ1,ω1 , where ρ 1 is any conjugate ρ 1 = β −1 ρ 2 β and ω 1 = ω 2 β (α may be chosen to be the identity map here).
We will provide a simple condition providing faithfulness of the action of B on X * . We first introduce some notation. For i ∈ Z, let B i be the subgroup of B obtained as the image of the kernel Ker(ω) under the i-th iteration of ρ, i.e. B i = ρ i (Ker(ω)). In particular, Proposition 2. The following conditions are equivalent: a 0 , and there is a basis of B with respect to which the matrix of ρ is given by and the matrix of ω is given by Figure 2). The action of b, b = 1, is nontrivial if and only if the ρ-orbit of b, is not entirely in B 0 . The statement (ii), (iii), and (iv) are all trivially fulfilled when m = 1. We assume m ≥ 2.
−2 has dimension at least 1, and is thus nontrivial. Thus, there exists a piece of a nontrivial ρ-orbit that lies entirely in B 0 . If we assume that the minimal polynomial f of ρ has degree strictly smaller than m, then the dimension of the ρ-cyclic space d ρ generated by d is at most m − 1, and therefore the above piece contains a basis for d ρ . This is a contradiction, since this would imply that the whole ρ-cyclic space d ρ lies in B 0 . Thus the minimal polynomial of ρ has degree m, implying that B is ρ-cyclic. Moreover, B = d ρ and a cyclic basis of B consists of d, ρ(d), . . . , ρ m−2 (d), ρ m−1 (d). The matrix of ρ with respect to this basis is exactly the matrix in (6), which is the companion matrix of the minimal polynomial their images under ω are trivial. On the other hand, the image of ρ m−1 must not be trivial, since ω is not trivial. Thus the matrix of ω is the one given in (7) (after re-scaling of the whole cyclic basis, if necessary).
(iv) implies (ii). In our chosen basis, the functional ω just reads the last coordinate of an input vector. The only way a ρ-orbit would lie entirely in B 0 is if the last coordinate stayed equal to 0 in the whole orbit. But T forces x m−3 to be 0, and so on. Eventually we obtain that the zero vector is in the orbit, and therefore the orbit is trivial. Thus B 0 does not contain nontrivial ρ-orbits.
From now on, only pairs (ω, ρ) for which the above faithfulness condition is fulfilled are considered.
Further, we often choose to work with the basis guaranteed by and described in Proposition 2. In order to specify a group in the family, we only specify the prime p and the polynomial f = x m + a m−1 x m−1 + · · · + a 1 x + a 0 . In particular, there is a sequence of elements d 0 , d 1 , . . . , d m−2 in B 0 and an element d m−1 in B 1 − B 0 , such that The action of B, and therefore the whole group G ω,ρ = G p,f , can be recovered from the relations in (8).
Definition 3. Let p be a prime and f = x m + a m−1 x m−1 + · · · + a 1 x + a 0 be a polynomial, which is invertible over p (i.e. a 0 = 0). The group G p,f is the group G ω,ρ , where ω and ρ are given by (7) and (6).
In practice, the decomposition formulas (8)  We list now all examples that have been explicitly mentioned in the literature and that fit in our construction. [1] and the action of the only nontrivial element b of B on X * is given by Example 2 (The first Grigorchuk group). The first Grigorchuk group G is the group G 2,x 2 +x+1 . The standard matrices of ρ and ω are (9) M ρ = 0 1 1 1 and M ω = 0 1 .
which are sufficient to define the action on X * . However, in practice, the decomposition formulas are given for the whole ρ- where c = db = [1 1] T , which is the usual way used to describe the action of Grigorchuk group (see (5)). The pattern aa1aa1 . . . and its shifts, evident in the action of b, c and d on X * (see Figure 1), is just a manifestation of the modulo 2 Fibonacci sequence 110110 . . . , which can be defined by iterations of the Fibonacci matrix M ρ in (9).
and M ′ ω = 1 0 1 , which clearly shows that G 2,x 3 +1 is generated by a copy of the dihedral group (generated by a and d 0 d 1 d 2 ) and a copy of the first Grigorchuk group (generated by a, d 0 d 1 and d 1 d 2 ).
Example 4 (Grigorchuk-Erschler group). Grigorchuk-Erschler group was first defined in [11], as a member of an uncountable family of groups of intermediate growth. This group is studied in more detail in [7]. It is the group G 2,x 2 +1 .
Example 5 (The Fabrykowski-Gupta group). The Fabrykowski-Gupta group was introduced and studied in [8]. It is the group G 3,x−1 . More generally, the group G p,x−1 has been studied in [14].
Proposition 3. Let f be a monic polynomial, invertible over p, which factors as G p,f is generated by its subgroups G p,f1 and G p,f2 , provided f 1 and f 2 are relatively prime.
where f 1 and f 2 are relatively prime then the ρ-cyclic basis of the ρ-cyclic subspace W b1 with minimal polynomial f 1 and the ρ-cyclic basis of the ρ-cyclic subspace W b2 with minimal polynomial f 2 form a basis of B. Thus G is generated by A, W b1 and W b2 , i.e., G is generated by G p,f1 and G p,f2 .
We will see that, for a fixed p and m, all groups G p,f defined by a polynomial of degree m share many properties. For a fixed prime p, we denote the family of groups defined by polynomials of degree m over the field of order p by G p,m . We denote by G the union of the families G p,m for all primes and all degrees.
We note again that the groups of the form G p,x−1 were studied in [14]. From now on, we mostly restrict our attention to the case m ≥ 2, which is in many ways crucially different than the case m = 1.

Elementary properties
Proposition 4. Let G be a group in G. The maps π A : G → A and π B : G → B given by π A (a 1 b 1 · · · a k b k a k+1 ) = a 1 · · · a k+1 and π B (a 1 b 1 · · · a k b k a k+1 ) = b 1 · · · b k , for a 1 , . . . , a k+1 ∈ A and b 1 , . . . , b k ∈ B, are well defined homomorphisms. The kernel of π A is the first level stabilizer G 1 , and it is equal to the normal closure The commutator of G is Proof. We provide only a sketchy proof, since this statement is analogous to the corresponding statements about the spinal groups defined in [6]. The claims related to π A follow from the fact that B ≤ G 1 and that the element g = a 1 b 1 · · · a k b k a k+1 can be rewritten as To prove the claims related to π B we need to show that if [ ] is a word over S = A ∪ B \ {1} (the bracketed letters in the front and at the end may be absent) that represents the identity in G, then b 1 . . . b k = 1 in B. This follows by induction on the length n of the words in S. The base cases regarding length 0 and 1 are trivial. For the inductive step, first observe that (11) |g i | ≤ |g| + 1 2 , for i = 0, . . . , p − 1, and that each letter b j , j = 1, . . . , k contributes ρ(b j ) to exactly one of the sections g i , i = 0, . . . , p − 1. Thus if b 1 . . . b k = 1 in B then ρ(b 1 ) . . . ρ(b k ) = 1 in B and therefore at least one of the words over S representing the sections of g does not project to 1 in B. But this contradicts the inductive assumption, since the words representing the sections must represent 1 in G and are shorter than n, as long as n ≥ 2 (by (11)).
Since the images of both π A and π B are abelian groups, we must have G ′ ≤ Ker(π A ) ∩ Ker(π B ). On the other hand, any element g = [ Proposition 5. Let G be a group in G.
(a) The map ψ is a subdirect embedding of G 1 into G × · · · × G (b) G is a self-replicating, spherically transitive group.
Proof. (a) Since, for b ∈ B, and, for the standard basis generator d m−1 , d a m−1 = (1, . . . , 1, b ′ , a) we see that the the coordinate p − 1 in ψ(G 1 ) projects onto G. Conjugating by a, we can move any coordinate in ψ(G 1 ) to any position. Thus ψ : G 1 → G × · · · × G is a subdirect embedding (surjective on each coordinate).
(b) For a vertex u = x 1 . . . x n , the map ϕ u : G u → G is equal to the composition ϕ xn . . . ϕ x1 and each of the maps ϕ x , x ∈ X is surjective, the map ϕ u is surjective as well. Thus G is self-replicating.
A self-replicating group that acts transitively on level 1 is always spherically transitive.

Branching property
Some notable examples of finitely generated branch groups, such as the first Grigorchuk group [9] and Gupta-Sidki group [19], were known and studied for two decades before some of their crucial properties were isolated and served as the model for the notion of a branch group, which was formally introduced in [14]. The relatively late arrival of the formal definition came despite the fact that the branching property was known and used for both examples for a long time. The branching property was established for the first Grigorchuk group in [11], while for the Gupta-Sidki group this was done in [18]. According to our needs, we will only define the notion of a regular branch group (see [14,5] for more information).
Let H (0) , . . . , H (k−1) and H be groups of automorphisms of the k-ary rooted tree. We say that H geometrically contains H (0) × · · · × H (k−1) if H (0) × · · · × H (k−1) ≤ ψ(H 1 ). Thus, for each x ∈ X, H contains a subgroup that acts on the subtree xX * exactly as the group H (x) does on X * and acts trivially on all other subtrees on the first level.
Definition 4. A group G of tree automorphisms is a regular branch group, branching over its subgroup K if (i) G acts spherically transitively on X * (ii) K is a normal subgroup of finite index in G (iii) K geometrically contains K × · · · × K.
We will show that our examples are regular branch groups, with the exception of the dihedral group D ∞ = G 2,x−1 (Lemma 1, for p = 3, and Lemma 6, for p = 2). Theorem 1. (a) Let G be a group in G p,m , p = 2, m ≥ 2. Then G is a regular branch group over the commutator subgroup G ′ . The Then G is a regular branch group over

5.1.
Odd prime case. For the duration of this subsection, containing a proof of Theorem 1(a), we assume that G is a group in G p,m , for some p = 2, m ≥ 2. The conditions that p is an odd prime or that m ≥ 2 are not needed all the time, so we clearly indicate each time which conditions are used. This is done with the intention of recycling some of the results and using them in the case p = 2.
Lemma 1. Let G be a group in G p,m , p = 2. Then G is a regular branch group over the commutator subgroup G ′ .
Note that the condition p = 2 is used in the above calculation. Thus, for b ′ ∈ B, Since ψ is a subdirect embedding (Proposition 5), for every g ∈ G, there exists h ∈ G 1 with ϕ p−1 (h) = g and therefore, for every g ∈ G, This implies that 1 × . . . 1 × G ′ ≤ ψ(G ′ ) and, since G acts transitively on level 1, Since G ′ is normal, has finite index in G (Proposition 4) and G acts spherically transitively (Proposition 5) it follows that G is a branch group over G ′ .
We emphasize that the above proof is valid for m = 1, which will not be the case with most of our other proofs that essentially use the existence of a nontrivial kernel B 0 of ω.
Lemma 2. Let G be a group in G p,m , m ≥ 2. For every nontrivial element d ∈ B 0 , the subgroup D = a, d ≤ G is finite. Moreover D, is isomorphic to the the wreath product Z/pZ ≀ Z/pZ (and therefore has p p+1 elements).
Proof. Both a and d have order p. Further, for i = 0, . . . , p − 1, (1, 1, . . . , ρ(d), 1, . . . , 1), where the section ρ(d) appears at the coordinate p−1−i. Thus, d a i , i = 0, . . . , p−1, commute and the normal closure d D of d in D is the elementary p group (Z/pZ) p on which a acts by shifting coordinates. The intersection a ∩ d D is trivial since d D stabilizes X (level 1 in the tree), while A acts freely on X.
Lemma 3. Let G be a group in G p,m , m ≥ 2. For any element d in B 0 − B 1 , the group G decomposes as where D = a, d and B 1 = B G 1 is the normal closure of B 1 in G. Proof. First, note that B 0 − B 1 is not empty (the standard generator d 0 is in this set). The group G is generated by d, B 1 , and a. Thus G = DB 1 . It remains to be shown that D∩B 1 = 1. Assume that g ∈ D∩B 1 . Since g is an element of D that stabilizes the first level, it has the form g = (d n0 1 , . . . , d . Let x ∈ X. Since g ∈ B 1 , the section g x of g has the form (a h1 On the other hand, since g x = d nx 1 , we obtain that d nx 1 ∈ B 2 . However, d ∈ B 0 − B 1 , and therefore d 1 ∈ B 1 − B 2 . Thus, d 1 ∈ B 2 and, since the order of d 1 is p, we must have n x = 0. Since each section of g must be trivial, we obtain that g = 1.
In order to determine the index of ψ −1 (G ′ × · · · × G ′ ) in G ′ we need to determine the index of ψ(G 1 ) in G × · · · × G.  (c) the index of ψ(
The subgroupĈ ≤ D × · · · × D can be described as follows. LetC be the set of elements g = (g 0 , . . . , g p−1 ) in D × · · · × D such that, for i = 0, . . . , p − 1, the exponent of d in π B (g i ) is equal to the exponent of a in π A (g i+1 ) (indices modulo p). We claim thatĈ =C. Indeed,C is closed for products and contains all generators ofĈ. ThusĈ ≤C. On the other hand, an arbitrary element g inC can be written as It is clear now that D × · · · × D =DĈ, since an arbitrary element in D × · · · × D can be multiplied by an element inD in such a way that the obtained product satisfies the requirements describingC. Also, it is clear thatD ∩Ĉ = 1. Indeed, (d n0 , . . . , d np−1 ) ∈Ĉ =C implies n 0 = · · · = n p−1 = 0.

Even prime case.
We consider now the case p = 2 and prove Theorem 1(b). We again proceed by subdividing the proof into several lemmas.
Lemma 5. Let G be a group in G 2,m , m ≥ 2. Then, Proof. Since π B (K) = 1 and the only element of B 1 with trivial B-projection is 1, we see that B 1 ∩ K = 1. Since K is normal in G, it is normal in B 1 as well. All that we need to show is that every element of B 1 is a product of an element in B 1 and an element in K. Let g ∈ B 1 . The group G is generated by the elements in B 1 together with a and the element d ∈ B 0 − B 1 from Lemma 3. In the factor group G/K all of these generators commute except possibly a and d. Thus the element g can be written as g = hb 1 k, for some h ∈ D, b 1 ∈ B 1 and k ∈ K. Since g, b 1 k ∈ B 1 and D ∩ B 1 = 1, we must have h = 1. Thus g = b 1 k.
The claim on the indices then follows from |B 1 | = 2 m−1 .
Lemma 6. Let G be a group in G 2,m , m ≥ 2. Then G is a regular branch group over K.
Proof. Let b be an element in B 1 with ω(b) = a and let d ∈ B 0 . Then [b, a] is in K and so is Since The rest of the proof proceeds just like in the case p = 2 (Lemma 1).

Lemma 7.
Let G be a group in G 2,m , m ≥ 2. Then there exists an element c ∈ B −1 − B 0 and an element d ∈ B 0 − B 1 such that c = (a, d). , d), (d, a) .
Proof. The element c is chosen just like in the case p = 2. (c) Follows from (a) and (b) and the observation that |D| = 2 3 . (d) All the relevant subgroups and indices are given in Figure 4.

Hausdorff dimension
Let G be a group in G p,m , m ≥ 2. Our results related to the branching structure of G allow us to calculate the Hausdorff dimension of the closure G in the pro-pgroup A(p) of p-adic automorphisms of the p-ary tree X * . The metric used on A(p) is the one defined in (4). With respect to this metric, the Hausdorff dimension of a closed subgroup G of A(p) can be calculated (see [2]) simply by comparing the relative sizes of the level stabilizers by Since [A(p) : A(p) n ] = p p n −1 p−1 and the group G is the closure of G, the above dimension formula reduces in our situation to (12) dim In particular, the dimension dim H (G) approaches 1 as m tends to infinity.
The proof will be derived as a consequence of the following lemmas and the dimension formula (12). Proof. (a) We identify π A (g u ) with the activity of g at u (indeed π A (g u ) = a k if and only if the activity of g at u is π k , where π is the cyclic permutation (0 . . . p − 1)). A vertex u with π A (g u ) = 1 is called an active vertex of g.
and the * 's are appropriately chosen integers, we obtain a generating set d ′ i , i = 0, . . . , m − 1, for B such that the only active vertex of d ′ i is v i , where the activity is a. Together with a, whose only activity occurs at v 0 these tree automorphisms act on X [m+1] as the full group od p-adic automorphisms.
Lemma 9. Let G be a group in G p,m , m ≥ 2.
(a) the stabilizer G m+1 is contained in the commutator G ′ . (b) when p = 2, the stabilizer G m+1 is contained in K.
Proof. (a) Let g ∈ G. If π A (g) = 1, then g is active at the root. Consider π B (g) and write it in terms of the generating set d ′ i , i = 0, . . . , m − 1. If π B (g) = 1, then one of these generators, say d ′ i , will appear with an exponent k from {1, . . . , p − 1}. But this means that there must be some active vertices of g at level m − i (in fact, a k is the product of all activites of g at level m − i). Thus if g ∈ G ′ , then there is some activity on at least one of the levels 0, . . . , m. Our claim follows by contraposition. Let g ∈ G m+1 and let it be written as a product of conjugates of δ i , i = 0, . . . , m− 1 (this is possible since the first m − 1 have order 2 and the last one is inverted by conjugating it by a). Consider now the section g 0 = ϕ 0 (g) of g. The section g 0 is in G m and is an element of d 1 , . . . , d m−1 , ca G . Since the projections π A and π B are constant on conjugacy classes of G, their images depend only on the parity of the number of conjugates of d i , i = 1, . . . , m − 1, and ca used to express g 0 , which in turn depend only on the parity of the number of conjugates of δ i , i = 0, . . . , m − 1 used to express g. Since π A (g 0 ) must be 1, we see that the number of conjugates of ca used in g 0 is even. Thus π B (g 0 ) depends only on the number of conjugates of d i , i = 1, . . . , m − 1, and is an element in B 1 = d 1 , . . . , d m−1 . We consider the action of g 0 on level m (it has to be trivial) and the activity only up to level m − 1. There is a change of generators of B 1 , . . .
where the * 's represents appropriately chosen integers, such that d ′ i , i = 1, . . . , m−1, has only one active vertex (up to level m − 1), which is at level m − i. Rewrite g 0 in terms of conjugates of d ′ i . Since conjugation does no change the parity of the total activity at some level, we see that in order for g 0 to stabilize level m, the parity of the number of conjugates of d ′ i used to express g 0 must be even, for i = 1, . . . , m−1. Using (13) to express g 0 back in terms of conjugates of d i , we see that the number of conjugates of d i , i = 1, . . . , m − 1, as well as the number of conjugates of ca, used in g 0 must be even, and therefore the number of conjugates of δ i , i = 0, . . . , m − 1 used in g must be even. In particular, g must be in K.
The following simple lemma applies to all regular branch groups (not necessarily subgroups of A(p)).
Lemma 10. Let G be a regular branch group acting on the k-ary tree X * , branching over a subgroup K that contains the level stabilizer G s . Then, for n ≥ s, Proof. The inclusion ψ(G n+1 ) ≤ G n × · · · × G n is valid for any group of tree automorphisms. For the converse, if (g 0 , . . . , g k−1 ) ∈ G n ×· · ·×G n , then (g 0 , . . . , g p−1 ) ∈ K × · · · × K and therefore there exists an element g ∈ G (in fact in K) such that ψ(g) = (g 0 , . . . , g k−1 ). The element g must come from G n+1 (otherwise at least one of its sections would not be in G n ).

Finitely constrained groups
Let P be a subgroup of the group Aut(X [s] ) of automorphisms of the finite k-ary tree of size s. We call P a group of patterns (of size s) and its complement F in Aut(X [s] ) a set of forbidden patterns. An automorphism f of X * does not contain a forbidden pattern from F if there is no section of f whose action on X s agrees with the action of some element in F (in other words, there is no section of f whose activity at each vertex on levels 0 through s − 1 agrees with the activity of some element in F ).

Definition 5.
A group G of tree automorphisms of X * is a finitely constrained group if there exists a finite set of forbidden patterns F of size s such that G consists of all elements in Aut(X * ) that do not contain forbidden patterns from F .
The following proposition is proved in [15] Proposition 7 ([15], Proposition 7.5). Let G be a spherically transitive, finitely constrained group of tree automorphisms of X * . Then G is a self-similar, regular branch group.
We will provide a characterization of spherically transitive, finitely constrained groups in terms of branch groups. Recall that a congruence subgroup of a group of tree automorphisms is any subgroup that contains a level stabilizer.
Theorem 3. Let G be a group of tree automorphisms of X * . The following are equivalent: (i) G is a spherically transitive, finitely constrained group (with forbidden patterns of size s + 1).
(ii) G is the closure of a self-similar, regular branch group H, branching over a congruence subgroup (containing the stabilizer H s of level s).
(iii) G is the closure of a self-similar regular branch group H, branching over a level stabilizer (level s).
Proof. (i) implies (iii). Evident from the proof of Proposition 7.5 in [15] (the proof itself claims that G is the closure of a self-similar regular branch group H, branching over H s+1 , but a careful reading reveals that the argument works equally well for H s ).
(ii) implies (i). Let G be the closure of a self-similar, regular branch group H, branching over a congruence subgroup K that contains H s .
Since H is spherically transitive, so is G. Also, note that G itself is self-similar (each section g u , in the limit g = lim h n of a sequence of automorphisms {h n } in H, is the limit g u = lim(h n ) u of the sequence of corresponding sections, which are all in H, by the self-similarity of H).
It follows from Lemma 10 that, for n ≥ s, ψ(H n+1 ) = H n × · · · × H n . Let F be the complement in Aut(X [s+1] ) of H/H s+1 and let G(F ) be the finitely constrained group of p-adic automorphisms defined by the forbidden patterns in F . If g in G then g cannot contain a pattern from F . Indeed, if it did, then one of its sections, which by self-similarity is also in G, would agree with an element in F on X s+1 . However, this is impossible, since this would mean that an element in H agrees with a forbidden pattern in F on X s+1 . Thus G ≤ G(F ).
Let g be an element in G(F ). We will prove by induction on n that g = lim h n , for some sequence {h n } of elements in H. In fact, we will show that, for every n ≥ 0, there exists an element h n in H such that h −1 n g ∈ Aut(X * ) n (recall that Aut(X * ) n is the stabilizer of level n in Aut(X * )). This is certainly true for n = s + 1. Indeed, g ∈ G(F ) and therefore its action on X n agrees with the action of some element h s+1 ∈ H. Assume n ≥ s + 2 and that the inductive claim is true for values smaller than n. Multiply g by h n−1 to obtain an element f = h −1 n−1 g ∈ Aut(X * ) n−1 . This element is still in G(F ) and so are its sections, f 0 , . . . , f k−1 . By inductive hypothesis, there are elements . . , k − 1, are elements in H n−2 , and therefore there exists an element n−1 g and we may take h n = h n−1 f ′ .
Corollary 2. Let G be a group in G p,m . m ≥ 2. Then the closure G is a finitely constrained subgroup of A(p) with forbidden patterns of size m + 2. Proof. (a) By Theorem 3 and Lemma 10, Proposition 6 applies. Note that any infinite self-similar group of p-adic automorphisms is transitive (by an unpublished argument of D. Savchuk).
Since G is infinite, the sequence of indices [G : G n ] is unbounded. It follows from Proposition 6(a) that r − t + 1 must be strictly positive, which, by Proposition 6(b), makes the Hausdorff dimension of G strictly positive. The dimension is rational since p, r, s and t are integers. However, the rationality of dim H (G) is not guaranteed in Theorem 4(b), since r, t, and ǫ are not necessarily integers. The following example shows that the dimension can be irrational even for closures of bounded automaton groups. Example 6. It is known that the closure G of the Hanoi group H on 3 pegs (see [17] for a definition of H as an automaton group) is finitely constrained group [16] with forbidden patterns of size 2. Thus G is a regular branch group over its level stabilizer Note that it would be wrong to use [H × H × H : ψ(H 1 )] = 2 5 instead of [G × G × G : ψ(G 1 )] = 2 in the above calculation. The difference comes from the fact that, even though G is a finitely constrained group that is the closure of the self-similar, regular branch group H, H is not branching over a congruence subgroup and therefore we cannot use the index [H × H × H : ψ(H 1 )] = 2 5 . Regarding Problem 7.1.(ii) from [15], it would still be interesting to check if the Hausdorff dimension of closed, self-similar groups of p-adic automorphisms is always rational.

Further finiteness properties
We quickly list some further properties of the groups in G, some of which come as consequences of known facts about some larger classes of groups that include G.
Proposition 8. Every group in G is amenable.
Proof. This follows from the fact that each group in G is defined by a bounded automaton and the general result on amenability of such groups in [3].
Proposition 9. Let G be a group in G p,m , m ≥ 2. The following are equivalent: (i) G is a p-group.
Proof. (ii) is equivalent to (iii). Clear. (ii) implies (i). Follows from general results on spinal groups in [6]. Assume that G is a p-group. Denote the order of an element g by Ω(g). Consider a ni b i . It does not fix the first level and therefore it is not trivial. Since each of the first level sections of (a ni b i ) p is conjugate to a ni+1 b i+1 we have that Ω(a ni b i ) = p · Ω(a ni+1 b i+1 ). Therefore, Ω(a n0 b 0 ) = p s · Ω(a n0 b 0 ), which is a contradiction.
In fact, it seems that the conditions in Proposition 9 are equivalent to the condition that the polynomial f defining G p,f does not have a binomial factor (of any degree). This is clearly always true in one direction (namely binomial factors induce elements of infinite order). The converse is also relatively straightforward for p = 2.
Proposition 10. Let G be a p-group in G p,m , m ≥ 2, and let r be the smallest integer such that B 0 ∪ B 1 ∪ · · · ∪ B r−1 = B. Then (a) then there exists a positive constant C such that the order of every element of G of length n is at most Cn (r−1) log 2 p , (b) G has intermediate growth and there exists positive constants c 1 and c 2 such that the growth function γ of G satisfies the inequalities c √ n 1 ≤ γ(n) ≤ c n α 2 , where α = log p log p−log η and η is the positive root of the polynomial x r +x r−1 +x r−2 −2. Proof. Follows from general results on spinal groups in [6].
Note that if every nontrivial ρ-orbit of B intersects B 0 nontrivially, then r is the smallest integer such that B 0 ∪ · · · ∪ B r−1 = B if and only if r − 1 is the largest length of a piece of a ρ-orbit that lies entirely outside of B 0 . If f is a primitive polynomial of degree m over the prime p, then there is only one nontrivial ρ-orbit and the corresponding value of r is m + 1. In a sense, the examples that are closest to the first Grigorchuk group are the ones defined by primitive polynomials over p.