On the density of certain languages with $p^2$ letters

The sequence $(x_n)_{n\in\mathbb N} = (2,5,15,51,187,\dots)$ given by the rule $x_n=(2^n+1)(2^{n-1}+1)/3$ appears in several seemingly unrelated areas of mathematics. For example, $x_n$ is the density of a language of words of length $n$ with four different letters. It is also the cardinality of the quotient of $(\mathbb Z_2\times \mathbb Z_2)^n$ under the left action of the special linear group $\mathrm{SL}(2,\mathbb Z)$. In this paper we show how these two interpretations of $x_n$ are related to each other. More generally, for prime numbers $p$ we show a correspondence between a quotient of $(\mathbb Z_p\times\mathbb Z_p)^n$ and a language with $p^2$ letters and words of length $n$.


Introduction
When we looked for the sequence, listed as sequence A007581 in the Online Encyclopedia of Integer Sequences [Slo], (x n ) n∈N = (2 n + 1)(2 n−1 + 1)/3 n∈N = (2, 5, 15, 51, 187, . . .) (1.1) we were greatly surprised to find that it arises in many different contexts. Indeed, there exist at least four distinct areas where the sequence appears: (1) the density of a language with four letters (see [MR05]); (2) the dimension of the universal embedding of the symplectic dual polar space (see [BB03]); (3) the number of isomorphy classes of regular fourfold covering of a graph with respect to the identity automorphism (see [HK93]); (4) the rank of the Z n 2 -cobordism category in dimension 1+1 (see [Seg12]).
In [Seg], the first author constructs a function which relates (2) and (1). In this paper we establish a relation between (1) and (4). The relation between (3) and (4) will be considered in a future paper.
The paper is organised as follows. In Section 2 we briefly describe (1) and (4) and give yet another interpretation of the sequence in Section 2.2 as the number of orbits of (Z p × Z p ) n under the left action of SL(2, Z). In Section 3 we give a bijection between these interpretations. Finally, in Section 5 we show where the sequence (1.1) appears and in topological field theory and in certain point-set geometries.
Throughout the paper, the cardinality of a finite set M is denoted by |M |.

Interpretations of the sequence
In this section we will present three instances where the sequence (1.1) naturally appears. For other interpretations of the sequence and their relation to the ones given below, we refer to [Seg] and [Slo, sequence A007581].

Density of a language
For a prime number p we consider a language with p 2 letters 0, 1, 2, . . . , p 2 −1. For n ∈ N we define the set W n p as the set of words a 1 a 2 . . . a n of length n such there exist 1 ≤ j < k ≤ n with: We call |W n p | the density of the language with p 2 − 1 letters and words of length n.
2.2 (Z p × Z p ) n / SL(2, Z) Let us consider the usual left action of SL(2, Z) on the vector space (Z p × Z p ) n . Vectors in this vector space are denoted by . . , v n ) ∈ Z n p are line vectors. Observe that SL(2, Z) is generated by the matrices 0 1 −1 0 and 1 1 0 1 . Two elements (u, v) t , (x, y) t ∈ (Z p ×Z p ) n belong to the same orbit if they can be transformed into each other by line transformations given by elements of SL(2, Z), that is we may exchange lines, or sum a multiple of one line to another. We call (u, v) t , (x, y) t ∈ (Z p × Z p ) n equivalent if they belong to the same orbit. Clearly this gives an equivalence relation. The equivalence class or the orbit Note that any two given orbits are either equal or disjoint. Let us consider the example p = 2. For n = 1, there are the two orbits {(0, 0) t } and {(1, 0) t , (0, 1) t , (1, 1) t }. For n = 2, there are the five orbits 0 0 0 0 , Note that for these examples the number of orbits coincides with the number of words of the type described in the section before. In Section 3 this will be proved rigorously.

Cobordism categories
The aim of this section is to calculate the rank of the fundamental group of the classifying space of the G-cobordism category for a finite abelian group G.
Recall that a category is a collection of objects and arrows, called morphisms. Examples are the category of sets and functions, the category of topological spaces and continuous functions, the category of smooth manifolds and smooth maps, etc.
Of interest for us is the so-called G-cobordism category. We first describe briefly the cobordism category. Its objects are finite disjoint unions of circles (note that the empty set is considered a circle). A cobordism between two objects Σ 1 and Σ 2 is an oriented surface M whose boundary is the disjoint union Σ 1 and Σ 2 , i.e. ∂M = Σ 1 Σ 2 . We consider two cobordisms as equal if there exists a diffeomorphism between them which is the identity in the boundary. The equivalence classes of the cobordisms are the morphisms of the cobordism category. Now let G be a finite abelian group of order |G| = n. The objects of the socalled the G-cobordism category are finite sequences (g 1 , ..., g m ) of elements in G. Each g ∈ G defines an n-fold covering of the unit circle by taking the product G × [0, 1] up to the identification (h, 0) ∼ (h + g, 1), for every h ∈ G. We call these n-fold coverings G-circles. As an example, consider G = Z 15 and g = 3. Then we have a 15-fold covering of the circle whose total space is the disjoint union of three circles, see Figure 1. Thus an object (g 1 , ..., g m ) can be identified with a disjoint union of m G-principal bundles over the circle. Let g = (g 1 , . . . , g m ) and h = (h 1 , . . . , h l ) be objects of the G-cobordism category and consider cobordisms between the total spaces of the n-fold coverings defined by g and h. A G-cobordism is a pair consisting of a cobordism together with a free action of the group G whose restriction to the boundary circles is given by We identify two G-cobordisms if there exists a diffeomorphism between them which commutes with the action and which is the identity in the boundary. The equivalence classes of the G-cobordisms obtained by this identification are the morphisms of the G-cobordism category. Morse theory [Mil63] provides a way to decompose every cobordism in a disjoint union of the elementary components cylinder, pair of pants and disc. Clearly, every Gcobordism from g = (g 1 , . . . , g m ) to h = (h 1 , . . . , h l ) determines a cobordism from the disjoint union of m circles to the disjoint union of l circles if we take the quotient by the group action. Such cobordisms can be decomposed in terms of elementary components: Figure 2: Illustration of a G-cobordism over the cylinder. The two circles of at the ends of the cylinder represent part of a G-circle (that is, an n-fold covering of the unit circle), both given by the same g ∈ G. The element k, describing the cobordism, twists the G-circles relative to each other. (1) The cylinder. Since the cylinder is homotopic to the circle and G is abelian, the two G-circles must be given by the same element g ∈ G.
The G-cobordism over the cylinder is defined by an element k ∈ G which reflects how twisted the n-covering is, see Figure 2.
(2) The pair of pants. The pair of pants is homotopic to the wedge of two circles S 1 ∨ S 1 . For two G-circles associated to the elements g, h ∈ G, the element associated to the wedge must be the sum g + h.
(3) Discs. Since any disc is contractible, it admits only one G-cobordism which is the associated to the trivial n-covering.
We will depict these elementary components as in Figure 3.
Consider the monoid inside the G-cobordism category defined by connected G-cobordisms which start and end in the trivial G-circle. This monoid is generated by elements of the form that is, by tori with two discs removed. We denote by r(G) the number of elements in the G-cobordism category of the form (2.1). The first author shows in [Seg12] that r(G) coincides with the rank of the fundamental group of the classifying space of the G-cobordism category. We recall that the morphisms of the G-cobordism category are given by classes of G-cobordisms up to diffeomorphism identification. We know from the theory of the mapping class group [FM12] that there are essentially two diffeomorphisms over the torus. Since a cobordism of the form (2.1) must be the identity in the boundary, these are exactly the diffeomorphisms between cobordisms. We denote the generator (2.1) by the pair (g, k). One diffeomorphism is the exchange of the two generators of the fundamental group which are not homotopic to the boundary components. This is given by the two ways of forming the torus as shown by the figure The change of (g, k) is illustrated by the following figures Note that depending of the orientation of the loop in (2.2) we have the identification (g, k) ∼ (−k, g) or (g, k) ∼ (k, −g). The other diffeomorphism, the so-called Dehn twist over the cylinder gives the identification (g, k) ∼ (g, k + g), see [FM12]. These two identifications are given by the matrices 0 1 −1 0 and 1 1 0 1 on G × G. These matrices are the generators of the special linear group SL(2, Z).
In summary, we proved the following result.
Theorem 2.2. For G an abelian finite group, the rank of the fundamental group of the classifying space of the G-cobordism category coincides with the cardinality of the quotient of G × G by the action of the special linear group SL(2, Z).
3 Bijection between W n p and (Z p ×Z p ) n / SL(2, Z) In this section we construct a bijection from W n p to (Z p × Z p ) n / SL(2, Z). As a corollary we obtain that both sets have the same cardinality whose value will be calculated in the next section.
Theorem 3.1. Let p be a prime number and n ∈ N. Then there exists a bijection between the sets W n p and (Z p × Z p ) n / SL(n, Z). Proof. The language under consideration has p 2 letters which will be denoted by 0, 1, 2, . . . , p 2 − 1. Let us define φ : {0, 1, . . . , p 2 − 1} → Z p × Z p by φ(a) = u v where u, v are the unique elements in {0, 1, . . . , p − 1} such that a = u + vp. Clearly, φ is a bijection. Now let us define f n : W n p → (Z p × Z p ) n , f n (a 1 a 2 . . . a n ) = (φ(a 1 ), φ(a 2 ), . . . , φ(a n )) and a 1 a 2 . . . a n ) = [f n (a 1 a 2 . . . a n )]. Clearly f n is well defined. We show that [f n ] is an injection. Since a word in it follows that b = 0. So S = id and (u, v) t = (x, y) t . We showed that the equivalence classes generated by elements of the form (3.1) and (3.2) are mutually disjoint, so f n is injective. In order to show that f n is surjective, we show that every nonzero (u, v) t ∈ (Z p ×Z p ) n belongs to an equivalence class generated by an element of the form (3.1) or (3.2). Let j ∈ {0, . . . , n} such that Without restriction we may assume that u j = 0 (note that (u, v) and (−v, u) t belong the same equivalence class). Choose m, n ∈ Z such that mu j + v j = 1 mod p and u + n = 1 mod p and set S 1 = 1 + mn n m − mn − 1 1 − n . Then S 1 ∈ SL(2, Z) and If v 1 i = 0 for all i ≥ j + 1, this is an element of the form (3.2). Otherwise there is a k ∈ {j + 1, . . . , n} such that v 1 i = 0 for all i ≤ k − 1 and v k = 0. Choose r ∈ Z such that u k + rv k = 0 mod p and set S 2 = 1 r 0 1 . Clearly S 2 S 1 ∈ SL(2, Z) and is an element of the form (3.2).
Proof. The first assertion is clear. For the second assertion note that (Z p × Z p ) 2 is the disjoint union of 0 and the orbits generated by vectors of the form Lemma 4.2. F (p, n) = p n−1 (p n + p − 1) for any prime number p and n ∈ N.
Recall that F (p, n) = r(p, n) − r(p, n − 1) and observe that (Z p × Z p ) n can be viewed as the subspace of all vectors in (Z p × Z p ) n+1 whose first column consists of 0 only. Since SL(2, Z) leaves zero columns invariant, F (p, n) is the number of different orbits in (Z p × Z p ) n+1 whose representatives have nonvanishing first column. Note that if the first column is not vanishing, we can always choose a representative whose first column is (1, 0) t . Now let (u, v) t be a vector in (Z p ×Z p ) n+1 with nonvanishing first column. Then this vector belongs to exactly one of the following cases: (1) The second column is vanishing. Then there exists S ∈ SL(2, Z) such . Clearly, the orbits generated by such vectors in (Z p × Z p ) n+1 with nonvanishing first column and vanishing second column correspond bijectively to the orbits of vectors in (Z p × Z p ) n with nonvanishing first column. Hence there are F (p, n − 1) distinct orbits of this type.
(2) The second column is nonvanishing and there exists S ∈ SL(2, Z) such with some a ∈ {1, 2, . . . , p − 1}. For fixed a, there exits a bijection between orbits generated such an elements and the orbits generated by vectors with nonvanishing first column in (Z p × Z p ) n . Clearly orbits with different a's are disjoint (see the proof of Theorem 3.1), we have (p − 1)F (p, n − 1) different orbits generated by elements of this type.
(3) The second column is nonvanishing and there exists S ∈ SL(2, Z) such that S u v = 0 1 . . . a 0 . . . with some a ∈ {1, 2, . . . , p−1}. It is easy to see that such vectors with different a's generate disjoint orbits, and that vectors with the same a but different tails (the last n − 1 columns) also generate disjoint orbits. Since there (p 2 ) n−1 different tails, the number of orbits generated by vectors of the form above is (p − 1)p 2n−2 .
Theorem 4.3. For any prime number p and n ∈ N we have Proof. As before let F (p, n) = r(p, n + 1) − r(p, n). By Lemma 4.2 we have that F (p, n) = p n−1 (p n + p − 1) .

Dual polar space
Let V be a vector space of dimension 2n over the field F 2 with the standard symplectic form. Then every maximal totally isotropic subspace of V has dimension n. It can be shown that every totally isotropic subspace of V of dimension n − 1 is contained in exactly three maximal totally isotropic subspaces. Let us consider the configuration (X, P ) where the set of points X consists of the maximal totally isotropic subspaces of V , the set of lines L consists of the totally isotropic spaces of dimension n − 1, and a point U lies on the line W if and only if W ⊆ U as vector spaces. Thus every line contains exactly three points. This point-line geometry is called dual polar space Sp 2n (2). Let F 2 L and F 2 X be the F 2 -vector spaces freely generated by L and X, respectively. Consider the map σ : F 2 L −→ F 2 X which sends every line of the graph to the sum of its three elements. The dimension of the universal embedding is given by the F 2 -dimension of the quotient udim := dim(F 2 X/σF 2 L). For n = 1, udim = 2; for n = 2, udim = 5. This can be easily verified in the configuration of Figure 4 by the following procedure: It is possible to mark 5 vertices such that, whenever there is a line with already two vertices marked, the missing one is marked too, in the end, all vertices will be marked. For n = 3 the configuration is unknown but it is known that it has 135 vertices and 80 lines. We conjecture that (1), (3) and (4) can be used to find a shortcut for the construction of these configurations. More details can be found in in [Seg].