Aperiodic two-dimensional words of small abelian complexity

In this paper we prove an abelian analog of the famous Nivat’s conjecture linking complexity and periodicity for two-dimensional words: We show that if a two-dimensional recurrent word contains at most two abelian factors for each pair (n,m) of integers, then it has a periodicity vector. Moreover, we show that a two-dimensional aperiodic recurrent word must have more than two abelian factors infinitely often. On the other hand, there exist aperiodic recurrent words with abelian complexity bounded by 3, as well as aperiodic words having abelian complexity 1 for some pairs (m,n). Mathematics Subject Classifications: 68R15, 37B50


Introduction
Nivat's conjecture, introduced at ICALP 1997, is a two-dimensional analog of a classical one-dimensional theorem of Morse and Hedlund.In their seminal paper Symbolic Dynamics (1938), besides giving formal foundations to a new mathematical field, they introduced the notion of complexity of an infinite word as a function p(n) which counts, for each integer n, the number of its distinct factors (i.e., blocks of consecutive letters) of length n.The factor complexity provides a useful measure of randomness of an infinite word and more generally of the subshift it generates.They further proved that an infinite word is periodic if and only if its complexity function satisfies p(n) n for each n.The latter result is referred to as Morse-Hedlund theorem.
Nivat's conjecture is a generalization of Morse-Hedlund theorem to two dimensions.A two-dimensional word w (or a configuration) is an element of Σ Z 2 , where Σ is a finite the electronic journal of combinatorics 26(4) (2019), #P4.15 set called an alphabet.In other words, this is a mapping w assigning a symbol from the alphabet Σ to every vertex of the lattice Z 2 .A word w is called periodic if there exists a vector v ∈ Z 2 such that for every point x ∈ Z 2 we have w(x + v) = w(x).A complexity in two dimensions is a function p w (m, n) counting for each m, n ∈ N the number of distinct rectangular m × n blocks.
Conjecture 1. (Nivat's conjecture [20]) Let w be a two-dimensional word, n, m two numbers such that the complexity p w satisfies p w (n, m) nm.Then w has a periodicity vector.
The problem to be studied concerns abelian complexity of multidimentional words and in particular an abelian analog of Nivat's conjecture under recurrence condition.Various abelian properties of (one-dimensional) words, including abelian complexity, have been widely studied recently, see, e.g.[1,16,21,22,25].A closely related paper studies balance in two-dimensional words [2].It is worth noting that, contrary to the one-dimensional case, in two dimensions balance is not equivalent to bounded abelian complexity.
The paper is organized as follows.In Section 2, we provide some background and give some definitions and notation.In Section 3 we provide our main results.In Subsection 3.1 we show that, contrary to the one-dimensional case, there exist aperiodic words with abelian complexity 1 for some block sizes.In Subsection 3.2, we show that for recurrent words abelian complexity cannot be bounded by 2. After providing some observations about small abelian complexity of one-dimensional words in Subsection 3.3, we show in Subsection 3.4 that for aperiodic recurrent two-dimensional words abelian complexity at least 3 must be achieved for infinitely many block sizes.

One-dimensional words
Let Σ be a finite non-empty set.For each infinite word w = w 0 w 1 w 2 • • • ∈ Σ N , the complexity or factor complexity p w (n) counts the number of distinct blocks w i w i+1 • • • w i+n−1 ∈ Σ n of length n occurring in w.In a similar way the complexity function can be defined for a biinfinite word w ∈ Σ Z .First introduced by Hedlund and Morse in their seminal 1938 paper [18] under the name of block growth, the factor complexity provides a useful measure of the extent of randomness of x and more generally of the subshift it generates.A celebrated theorem of Morse and Hedlund in [18] states that every aperiodic word contains at least n + 1 distinct factors of each length n.
An infinite word w is called recurrent if each of its factors occurs in it infinitely many times.An infinite word w is called uniformly recurrent if for each integer n there exists an integer N such that each of factors of w of length N contains all factors of w of length n.In other words, a word is uniformly recurrent if each its factor occurs in it with bounded gap.An infinite word w is called eventually periodic if there exist integers N and T such that w n+T = w n for each n N .An infinite word w is called purely periodic if w n+T = w n for each n 0. A word is aperiodic if it is not ultimately periodic.A biinfinite word w is periodic if w n+T = w n for each integer n and aperiodic otherwise.For more on periodicity we refer to [26].
For a finite word v and a letter a, we let |v| a denote the number of occurrences of a in v.The frequency of a in v is Freq a (v) = |v|a |v| .A (bi-)infinite word w has uniform frequency of a letter a if the ratio |w k •••w k+n−1 | n has a limit Freq a (w) when n → ∞, uniformly in k.An infinite word is called balanced if each its two factors u and v of the same length satisfy ||u| a − |v| a | 1 for each letter a ∈ Σ.
Theorem 2 (Morse and Hedlund, 1938).Let w be a one-dimensional word.If there exists n such that p w (n) n, then w is eventually periodic.
Words satisfying p x (n) = n + 1 for each n 0 are called Sturmian words, and hence are regarded as the simplest aperiodic words.Sturmian words admit various types of characterizations of geometric and combinatorial nature, e.g., they can be defined via balance, complexity, morphisms, etc. (see Chapter 2 in [15]).
In this paper we are interested in extending the result of Morse and Hedlund to the abelian setting.Two finite words u and v are abelian equivalent if for each letter a, the number of occurrences of a in u (denoted |u| a ) is equal to |v| a .In other words, u and v are permutations of one another.It is straightforward that abelian equivalence is indeed an equivalence relation on the set of finite words.For each infinite word w = w 0 w 1 w 2 • • • ∈ Σ N , the abelian complexity a w (n) counts the number of distinct abelian classes of blocks w i w i+1 • • • w i+n−1 ∈ Σ n of length n occurring in w.Ordering the alphabet Σ = {a 1 , . . ., a k }, we define Parikh vector of a finite word v over Σ as P V (v) = (|v| a 1 , . . ., |v| a k ).The set of Parikh vectors of factors of length n of an infinite word w is then denoted by P V w (n) (the index w is omitted when no ambiguity arises).Lemma 3. Let w be a one-dimensional word.If there exists n such that a w (n) = 1, then w is purely periodic.
On the other hand, Sturmian words are aperiodic and have abelian complexity 2 for each n, and moreover this is a characterization: Theorem 4 ( [19]).Sturmian words are aperiodic one-dimensional words with abelian complexity a w (n) = 2 for each integer n.
Therefore, Sturmian words are aperiodic words of minimal abelian complexity as well.We remark that the above results and definitions extend to biinfinite words.

Two-dimensional words
A two-dimensional word w is called periodic if there exists a pair of integers (m, n) such that w(x, y) = w(x + m, y + n) for each pair (x, y) of integers.A two-dimensional word w is called fully periodic if there exist two integer vectors (m 1 , n 1 ), (m 2 , n 2 ) linearly independent over Q, such that w(x, y) = w(x + m i , y + n i ) for each pair (x, y) of integers and i = 1, 2. By an m × n factor (or block) of a two-dimensional word w we mean a rectangular fragment of w of the form for some integers x, y.We say that the block occurs at position (x, y) and we let B m,n (x, y) denote such a block.Similarly to the one-dimensional case, the abelian complexity a w (m, n) of a twodimensional word w is defined as the number of abelian classes of m × n blocks.A two-dimensional word is balanced if for each pair (m, n) of integers, each letter a and any two m × n-factors u and v of the words it holds ||u| a − |v| a | 1.Sometimes Cbalance is defined if the equality ||u| a − |v| a | C holds.We remark that although in the one-dimensional case bounded abelian complexity is equivalent to C-balance for some constant C, in two dimensions it is not true: Consider, for example, a word with alternating horizontal lines of 1's and of 0's.This word has bounded abelian complexity but is not balanced.
A two-dimensional word w is called recurrent if each its factor occurs in it infinitely many times.An infinite word w is called uniformly recurrent if for each integer n there exists an integer N such that each square N × N factor of w contains all square factors of w of size n × n.For different versions of recurrence in 2D-words, we refer to [4].
We now need a few technical definitions.We call an (m, n)-lattice rooted in (x, y) ∈ Z 2 the set {(x, y) + (mi, nj)|i, j ∈ Z}.We remark that we can assume that 0 x < m, 0 y < n, and that this way Z 2 is split into mn many (m, n)-lattices.
A two-dimensional infinite word w has uniform frequency of a letter a if the ratio |Bm,m(x,y)|a m 2 has a limit Freq a (w) when m → ∞, uniformly in (x, y).We will also use the notation P V w (m, n) for the set of Parikh vectors of m × n-blocks of a word w (the index w is omitted when no ambiguity arises).The abelian complexity then satisfies a w (m, n) = P V w (m, n).

Small abelian complexity of two-dimensional words
In this section we provide our main results.In the first subsection we consider the case of abelian complexity equal to 1 for some blocks.In particular, we study the structure of such words and show that, contrary to the one-dimensional case, there exist aperiodic words with abelian complexity 1 for some block sizes.In the second subsection we show that for recurrent two-dimensional words abelian complexity cannot be bounded by 2, but there exist aperiodic recurrent two-dimensional words with abelian complexity bounded by 3. In the third subsection, we give some observations about small abelian complexity of one-dimensional words.Finally, in the last subsection we show that for aperiodic recurrent two-dimensional words abelian complexity at least 3 must be achieved for an infinite number of block sizes.

Abelian complexity 1 from some block size
First we describe the structure of two-dimensional words having abelian complexity 1 for some block size: Theorem 5. Let w be a two-dimensional word, and let a w (m, n) = 1 for some integers m and n.Then in each (m, n)-lattice w is either (0, n)-periodic or (m, 0)-periodic, i.e., we have either w(x, y) = w(x + m, y) for each point (x, y) from the lattice, or w(x, y) = w(x, y + n) for each point (x, y) from the lattice.
Proof.Consider an (m, n)-lattice and any point (x, y) ∈ Z 2 from the lattice.Considering Parikh vectors of four m × n rectangles B m,n (x, y), B m,n (x + 1, y), B m,n (x, y + 1), B m,n (x + 1, y +1), we will now prove that we get that either w(x, y) = w(x+m, y) and w(x, y +n) = w(x + m, y + n) or w(x, y) = w(x, y + n) and w(x + m, y) = w(x + m, y + n).
For brevity, we denote For a letter a, we let v a denote the Parikh vector of a single element a.Since a w (m, n) = 1, the Parikh vectors of all m × n blocks are the same.Now (1) and ( 2) If the (m, n)-lattice is not filled with a single letter, we have at some point (x, y) from the lattice w(x, y) = w(x, y + n) or w(x, y) = w(x + m, y).Consider the first case (the second one is symmetric).From what we proved above, in the first case we have w(x, y) = w(x + m, y) and w(x, y + n) = w(x + m, y + n) (the second option is not possible due to the conditions of the case).By a similar reasoning as in the previous paragraph applied to the point (x + m, y), we get that w(x + m, y) = w(x + 2m, y) and w(x + m, y + n) = w(x + 2m, y + n), and extending this line of reasoning we obtain w(x, y) = w(x + im, y) and w(x, y + n) = w(x + im, y + n) for any integer i.Now applying the same considerations to the point (x + im, y + n), we get that either w(x + im, y + n) = w(x + (i + 1)m, y + n) and w(x + im, y + 2n) = w(x + (i + 1)m, y + 2n) or w(x + im, y + n) = w(x + im, y + 2n) and w(x + (i + 1)m, y + n) = w(x + (i + 1)m, y + 2n).Since we proved that w(x + im, y + n) = w(x + (i + 1)m, y + n), in any case we have w(x + im, y + 2n) = w(x + (i + 1)m, y + 2n).Extending this line of reasoning, we get (m, 0)-periodicity in each of the horizontal lines of the lattice and hence in the whole lattice.In the second case in a symmetric way we get (0, n)-periodicity in the lattice.Theorem is proved.
The following proposition shows that, contrary to one-dimensional case (Lemma 3), there exist aperiodic two-dimensional words that have abelian complexity 1 for some values m and n.Proposition 6.There exists an aperiodic two-dimensional word w with abelian complexity a w (m, n) = 1 for infinitely many pairs (m, n).
In the similar way we fill in the remaining blocks: we can fill in the blocks {2j + 2, 2j + 3} × {0, 1}, j ∈ Z choosing one of the two blocks for any j in arbitrary way, and continue by (0, 2)-periodicity to fill into the blocks {4j + 2, 4j + 3} × {2i, 2i + 1}, i, j ∈ Z.Here is an fragment of such a word, with letters from the (4, 2)-lattices rooted in (x, y) ∈ {0, 1} 2 marked by bold: It is not hard to see that any 4 × 2 rectangle has four occurrences of 0 and four occurrences of 1.Clearly, this holds true for blocks with even coordinates, since it contains two blocks of the form 0 1 1 0 or 1 0 0 1 .Its shifts by (0, 1), (1, 0) or (1, 1) have the same Parikh vector due to (4, 0) or (0, 2)-periodicity in corresponding lattices and the block structure.
We remark that this word has abelian complexity 1 for infinitely many values (m, n), for example for values of the form (4m , 2n ), where m and n are any integers.It is not hard to show that its abelian complexity is at most 3.One can show that considering position of an (m, n)-block relatively to initial block and consider its shifts by one of the 8 vectors in {0, 1, 2, 3} × {0, 1}.Proposition is proved.

Abelian complexity bounded by 2
We start this section with an obvious example: Example.There exists an aperiodic two-dimensional word w with abelian complexity a w (m, n) = 2 for all pairs (m, n).Just take w(0, 0) = 1 and w(i, j) = 0 if (i, j) = (0, 0).
Clearly, the word from the example is not recurrent.The aim of this subsection is to prove that for recurrent words the abelian complexity cannot be bounded by 2: Theorem 7. Let w be a two-dimensional aperiodic recurrent word.Then there exist integers m and n such that a w (m, n) 3.
We first prove a few simple technical lemmas.Lemma 8. Let w be a one-dimensional binary word with uniform frequency of 1 equal to α, 0 < α < 1.Then for each N there exists n N such that a w (n) 2.
Proof.If α is irrational, clearly, we cannot have abelian complexity 1 for any n, since otherwise the word would have rational uniform frequency given by |v| 1 n for a factor v of w of length n.If α is rational, α = p q , then take n to be any prime number greater than q and N .Then the uniform frequency of 1 is |v| 1 n for a factor v of w of length n, which cannot be equal to p q , since n is a prime greater than q and α = 0, 1. Lemma 9. Let w and w be one-dimensional binary words with uniform frequencies of 1 equal to α 0 and α 1 , respectively.If α 0 = α 1 , then there exists N such that P V w (n) ∩ P V w (n) = ∅ for each n N .
Proof.Follows from the definition of uniform frequency.
Proof of Theorem 7. Assume that for each m, n we have a w (m, n) 2. First note that taking m = n = 1 we get that the word is binary; we let 0 and 1 denote the letters.Taking n = 1, we get that in horizontal lines we have abelian complexity at most 2 for each m.This means that in each horizontal line there exists a uniform frequency of 1.Since abelian complexity is at most 2 for each n, the uniform frequency can take at most two distinct values.
First consider the case of two values.Clearly, these two values cannot be achieved in one horizontal line.So, we have one uniform frequency in some lines and another uniform frequency in other lines.Lemma 9 implies that for n big enough we must have only one Parikh vector in each line.Let α be the uniform frequency in one of the lines.If α = 0, 1, then, due to Lemma 8, for some n, which can be chosen as big as needed, we must have at least two distinct Parikh vectors, which gives at least three in total together with Parikh vector of another uniform frequency -a contradiction.Therefore, the only possible case of two distinct uniform frequencies is given by 0 and 1.It is not hard to see that lines with uniform frequency 1 can only be all-ones lines and lines with uniform frequency 0 can only be all-zero lines.Indeed, otherwise we necessarily have abelian complexity at least 3 for n = 2: we have factors 00 and 11 in the lines with uniform frequency 0 and 1, respectively, and we must have factor 01 or 10 if some line contains both 0 and 1.And in the case when lines with uniform frequency 1 are all-ones lines and lines with uniform frequency 0 are all-zero lines we have a periodicity vector (1, 0).
Therefore, in all horizontal lines we have the same uniform frequencies of letters.Symmetrically, we also have the same uniform frequencies of letters in all vertical lines.Taking into account our assumption about abelian complexity at most 2, we have balance in 1 × m and n × 1 rectangles.Now for any (m, n) consider an m × n-rectangle and a vertical stripe of width m containing it.Consider such a rectangle and its vertical shift by one.These two rectangles have a (m − 1) × n-rectangle in common (plus a m × 1-rectangle each).Since we have balance in m × 1-rectangles and abelian complexity 2 for m × n rectangles, we get balance in m × n-rectangles in each vertical stripe of width m.Symmetrically, we get balance in each horizontal stripe of height n.Now from abelian complexity 2 in m × n-rectangles we get balance in m × n-rectangles.
Now we use the characterization of balanced two-dimensional words by V. Berthé and R. Tijdeman [2].In the paper, Corollary from the Introduction states the following: ). Two-dimensional 1-balanced words have uniform frequencies of letters, and moreover they are fully periodic unless the uniform frequency of 1-s equals 0 or 1.
On the other hand, it is not hard to describe balanced words of uniform frequency 0 (or, symmetrically, 1).Clearly, each rectangular block must have at most one occurrence of 1 (otherwise we have unbalanceness, since in a word with uniform frequency 0 we must have an all-0 block of any size).So, the whole two-dimensional word has at most one occurrence of 1.Therefore, this is either all-0 word, or a word containing only one occurrence of 1.The first one is fully periodic, the second one is not recurrent.The theorem is proved.
In Proposition 6 we saw that there exist aperiodic words with abelian complexity at most 3 and equal to 1 for some pairs (m, n), but the abelian complexity 1 still gives some periodicity-like structure (periodicity in lattices).The following proposition shows that we can in fact have abelian complexity at most 3 without this periodicity-like structure: Proposition 11.There exist recurrent aperiodic two-dimensional words that have abelian complexity 2 or 3 and are aperiodic in any lattice.Proof.To build such an example, we start with any binary word x ∈ {0, 1} Z .We build a the electronic journal of combinatorics 26(4) (2019), #P4.15 two-dimensional word w by 2 × 2 blocks in the following way: For the proof we define a "domino pair" to be a pair of adjacent elements of the form w 2k,l w 2k+1,l+1 or w k,2l+1 w k,2l .Note that each "domino pair" contains exactly one occurrence of 0 and one occurrence of 1 by construction.
To prove that abelian complexity a w (m, n) of this word is at most 3, we consider three cases: Case 1: m and n are both odd.In this case the Parikh vector of an (m × n)-block can be divided into mn−1 2 domino pairs plus one element which can be either 0 or 1 (See Fig. 1), hence in this case a w (m, n) = 2 and Case 2: one of the numbers m and n is odd, and the other one is even.Without loss of generality suppose that n is odd and m is even.Here we have two subcases: either (m × n)-block is situated in a point with an even second coordinate, or with an odd one.In the first subcase the (m × n)-block contains mn 2 domino pairs and hence the Parikh vector is ( mn 2 , mn 2 ) (See Fig. 1, Case 2a).In the other subcase the (m × n)-block contains mn 2 − 1 domino pairs plus two points (See Fig. 1, Case 2b).These two points can be either both 0, or both 1, or one of them 0 and the other one 1, which gives three possible Parikh vectors, one of which coinciding with the previous subcase: and a w (m, n) = 3. Case 3: both m and n are even.Here we have two subcases: either (m × n)-block is situated in a point with one or both even coordinates, or both coordinates are odd.In the first subcase the (m × n)-block contains mn 2 domino pairs and hence the Parikh vector is ( mn 2 , mn 2 ) (See Fig. 1, Case 3a).In the other subcase the (m × n)-block contains mn 2 − 2 domino pairs plus four points of the form (2k + 1, 2l + 1), (2k + m, 2l + 1), (2k + 1, 2l + n) and (2k +m, 2l +n) (See Fig. 1, Case 3b).By construction, if x s = x t , then w 2s,i = w 2t,i = 1−w 2s+1,i = 1−w 2t+1,i for each i; and if x s = x t , then w 2s,i = 1−w 2t,i = 1−w 2s+1,i = w 2t+1,i for each i.Applying this observation to (s, t) ∈ {(k, l), (k + m 2 , l), (k, l + n 2 ), (k + m 2 , l + n 2 )} (for example, using a straighforward case study), we get three Parikh vectors: and a w (m, n) = 3. Summing up, the abelian complexity of this word is given by: It is not hard to see that if x is recurrent and aperiodic, then w is recurrent and aperiodic.The proposition is proved.

Some observations on abelian complexity of one-dimensional words
By Lemma 3 we know that the abelian complexity of an aperiodic one-dimensional word is at least 2 for each n.Theorem 4 says that aperiodic words achieving the minimal abelian complexity 2 for each n are exactly Sturmian words.Can an aperiodic word have abelian the electronic journal of combinatorics 26(4) (2019), #P4.15 complexity greater than 2 for only one (or finitely many) values of n?The following lemma basically says in an aperiodic non-Sturmian case the abelian complexity is not minimal for infinitely many n: Lemma 12. Let w be a binary aperiodic one-dimensional word which is not balanced.Then we have a w (n) 3 for infinitely many n.
Proof.Since w is not balanced, there exists a length k for which at least three abelian classes exist.Since the word is aperiodic, each of its suffixes is aperiodic.Hence in its suffix for each length there are at least two abelian classes of factors, which means that for each length factors from at least two abelian classes occur infinitely many times in w.Without loss of generality assume that for length k two abelian classes of factors occurring infinitely many times contain m and m + 1 occurrences of a, and there also exists a factor u containing m − 1 occurrences of a (possibly occurring only finitely many times).We let s denote some position of an occurrence of u.Consider an occurrence of a factor v from the class with m + 1 occurrences of a.We let t denote the position of this occurrence, and we remark that t can be chosen bigger than any given constant.Now consider two factors U = w s • • • w t−1 and V = w s+k • • • w t+k−1 of the same length t − s, which can be bigger than any given constant by the remark above.
Therefore, we have at least three abelian classes of words of length (t − s).Since t can be chosen bigger than any number, we have infinitely many lengths with 3 abelian classes.
The lemma is proved.
We remark that for biinfinite words Lemma 12 does not hold, for example, the following word: has three abelian classes of length 2 and two abelian classes for length greater than 2. By the definition of periodicity for biinfinite words, this word is aperiodic -although obviously it has some periodicity structure similar to ultimate periodicity (prefixes and suffixes are periodic).However, for aperiodic biinfinite words recurrence is enough to guarantee that it is impossible to have three abelian classes for finitely many lengths: Lemma 13.Let w be a binary aperiodic recurrent biinfinite one-dimensional word which is not balanced.Then we have a w (n) 3 for infinitely many n.
Proof.Suppose the converse, and let n denote the biggest length for which we have three or more abelian classes.Consider two factors u, v of w of length n with |u| 1 − |v| 1 2. Since w is recurrent, u and v occur infinitely many times in w.In particular, this means that for each N ∈ N, there exist an occurrence of u at position i and an occurrence of v at position j, such that |j − i| > N .Without loss of generality suppose that j > i.Then Therefore, for length j − i we also have at least three abelian factors.A contradiction.

Abelian complexity eventually bounded by 2
A fact similar to Lemma 13 is true also for two-dimensional words and even in a slightly stronger form (no aperiodicity is needed), although the proof is more complicated: Theorem 14.Let w be a binary two-dimensional recurrent word whose abelian complexity is not bounded by 2, i.e. there exists a pair (m, n) of integers with a w (m, n) > 2. Then there exists infinitely many pairs (m, n) for which the inequality holds.
The proof is split into several lemmas.Lemma 15.Let w be a binary two-dimensional word such that its abelian complexity is eventually bounded by 2, i.e. there exist M, N ∈ N such that for each (m, n) with n > N or m > M we have a w (m, n) 2. Then w has uniform frequencies of letters.Moreover, the balance condition is satisfied for m × n-rectangles with n > N or m > M .
Proof.The proof is similar to the first part of the proof of Theorem 7. Taking n = 1, we get that in horizontal lines we have abelian complexity at most 2 for each m > M .This means that in each horizontal line there exists a uniform frequency of 1.Since abelian complexity is at most 2 for each m > M , the uniform frequency can take at most two distinct values.
First consider the case of two values.Clearly, these two values cannot be achieved in one horizontal line.So, we have one uniform frequency in some lines and another uniform frequency in other lines.Lemma 9 implies that for m big enough we must have only one Parikh vector in each line.Let α be the uniform frequency in one of the lines.If α = 0, 1, then, due to Lemma 8, for some m, which can be chosen as big as needed, we must have at least two distinct Parikh vectors, which gives at least three in total together with Parikh vector of another uniform frequency -a contradiction.Therefore, the only possible case of two distinct uniform frequencies is given by 0 and 1.It is not hard to see that lines with uniform frequency 1 can only be all-ones lines and lines with uniform frequency 0 can only be all-zero lines.Indeed, otherwise we necessarily have abelian complexity at least 3 for each m > 2: we have factors 0 m and 1 m in the lines with uniform frequency 0 and 1, respectively, and we must have factor 01 m−1 or 10 m−1 if some line contains both 0 and 1.And in the case when lines with uniform frequency 1 are all-ones lines and lines with uniform frequency 0 are all-zero lines we have a periodicity vector (1,0).
Therefore, in all horizontal lines we have the same uniform frequencies of letters and the balance condition for m × 1-rectangles with m M .Symmetrically we prove that the uniform frequencies are the same in vertical lines, and get balance condition in vertical rectangles.The existence of uniform frequency and balance follows.The balance in m × n rectangles is proved in exactly the same way as in the Theorem 7. Lemma is proved.Lemma 16.Let w be a two-dimensional word satisfying the conditions of Lemma 15.Then the uniform frequencies of letters in w are rational.
To prove that, we will make use of properties of Sturmian words and in particular their definition via rotations.Before giving the proof, we provide some facts about Sturmian the electronic journal of combinatorics 26(4) (2019), #P4.15 words, making use of their definition via rotations.In [19], Morse and Hedlund showed that each Sturmian word may be realized geometrically by an irrational rotation on the circle.More precisely, every Sturmian word x is obtained by coding the symbolic orbit of a point ρ(x) on the circle (of circumference one) under a rotation by an irrational angle α where the circle is partitioned into two complementary intervals, one of length α (labeled 1) and the other of length 1 − α (labeled 0).And conversely each such coding gives rise to a Sturmian word.The irrational α is called the slope and the point ρ(x) is called the intercept of the Sturmian word x.More precisely, a Sturmian word s α,ρ is defined as where I 1 = (1 − α, 1] and I 0 = (0, 1 − α] (or I 1 = [1 − α, 1) and It is well known (e.g.[17], see also a short survey in [11]) that each of the m + 1 factors of a Sturmian word of length m corresponds to a half-open interval on the circle.More precisely, if we arrange the m + 2 points 0, 1, {−α}, {−2α}, . . ., {−mα} in increasing order, we determine a partition of the circle into m + 1 half-open subintervals L 0 (m), L 1 (m), . . ., L m (m).Each of these subintervals is in bijection with a factor of length m of a Sturmian word of slope α.Moreover, the factors associated with these intervals are lexicographically ordered.
Recall that a factor of length m of a Sturmian word s α has a Parikh vector equal either to ( mα , m − mα ) (in which case it is called light) or to ( mα , m − mα ) (in which case it is called heavy).We let I(α, β), α, β ∈ [0, 1), α < β, denote the interval [α, β) if 0 ∈ I 1 and for (α, β] if 0 / ∈ I 1 .The following proposition relates the intervals L i (m) to the Parikh vectors of the associated factors: Proposition 17 (Proposition 3.3.in [11]; see also Theorem 19 in [23]).Let s be a Sturmian word of angle α and m be a positive integer.Let t i be the factor of length m associated with the interval L i (m).Then t i is heavy if L i (m) ⊂ I({−mα}, 1), while it is light if L i (m) ⊂ I(0, {−mα}).
Proof of Lemma 16.Suppose the uniform frequencies are irrational.We let α denote the uniform frequency of 1. Due to balance in m × 1 blocks (given by Lemma 15), we have uniform frequency α in all horizontal lines.Hence all horizontal lines, as well as their oneway infinite suffixes, are aperiodic.By Lemma 12, in each line we have a balanced word with the same irrational uniform frequencies of letters, hence all the words in horizontal lines are Sturmian with the same slope.
We will now prove that in this case, for two consecutive horizontal lines (corresponding to y = t and y = t + 1), there exists m > M (where M is as in Lemma 15) and positions i and j such that ||B m,2 (i, t)| 0 − |B m,2 (j, t)| 0 | = 2 (equivalently, for any two Sturmian words of the same slope, there exist infinitely many m such that they both have at some position factors are light, and in another position factors heavy).This means that w is unbalanced in rectangle m × 2 with m > M , which gives the unbalance contradicting Lemma 15.First note that by Kronecker's theorem (see, e.g., [13]), the points {−mα} the electronic journal of combinatorics 26(4) (2019), #P4.15 choice of S and T is not necessarily unique, and that for M and N defined in Lemma 15, we have M S, N T .So, there exist an integer l and occurrences of S × T -blocks with > l occurrences of 1, l occurrences of 1 and < l occurrences of 1.By Lemmas 15 and 16, the uniform frequency of 1 in w exists and is rational; we let λ denote this uniform frequency.
Claim 1 : Let (x, y) be an occurrence of S × T -block with > l occurrences of 1, i.e., |B S,T (x, y)| 1 > l.Then for each x > x + M we have |B S,T (x , y)| 1 l.Symmetrically, the same holds for (x , y) with x < x − M and for each (x, y ) with y > y + N or y < y − N .And, symmetrically, one can replace > l with < l and obtain a similar statement.(and since we have non-binary alphabet, there is at least one such letter).Moreover, periodic letters must appear in each horizontal line (otherwise there will be a third Parikh vector).Now take any pair of relatively prime numbers (m 1 , m 2 ) and notice that any two arithmetic progressions with differences m 1 and m 2 intersect.Hence the (m 1 , 0)-periodic letter is the same as m 2 -periodic letter.Now since for any integer n there exist integers p and q such that n = pm 1 + qm 2 , we obtain that the whole word is constituted from this single letter.A contradiction.

Conclusions
In the paper we considered the minimal abelian complexity of two-dimensional words under the condition of recurrence.We saw that: (1) There exist aperiodic infinite words with abelian complexity 1 for infinitely many pairs (m, n) (contrary to one-dimensional case, where abelian complexity equal to 1 for some length n implies periodicity).( 2) Although the minimal abelian complexity of aperiodic two-dimensional words can be equal to 2 for all pairs (n, m), under the condition of recurrence it cannot be bounded by 2.Moreover, it must be greater than two for infinitely many pairs (n, m).(3) There exist uniformly recurrent words with abelian complexity bounded by 3.An interesting open question concerns the (non-abelian) Nivat's conjecture under the condition of recurrence.It has been recently proved that if we assume that an infinite word is uniformly recurrent and for some (m, n) its complexity is bounded y mn, then it has a periodicity vector [14].On the other hand, Julien Cassaigne characterized infinite words of complexity mn + 1 [9].In particular, he showed that none of such sequences is uniformly recurrent.A challenging open problem is to find uniformly recurrent aperiodic two-dimensional words of the lowest complexity.We remark that one well-known family of two-dimensional words of low complexity include Sturmian words, i.e., words obtained by a rotation on a torus [3]: Let α, β be real numbers, with 1, α, β rationally independent, and 0 < α + β < 1.The two-dimensional Sturmian word s over the three-letter alphabet {1, 2, 3} (with parameters α, β, ρ) is defined as s m,n = i ⇔ (mα + nβ + ρ modulo 1) ∈ I i , where I 3 = [0, α), I 2 = [α, α + β), I 1 = [α + β, 1) (the intervals may also be all half-open on the left).These words have no periodicity vector and they have complexity p(m, n) = mn + m + n.A projection of a two-dimensional Sturmian word defined by v(m, n) = 1 if and only if s(m, n) = 1 or 3 and v(m, n) = 2 if and only if s(m, n) = 2 gives an example of a two-dimensional uniformly recurrent word of complexity y p(m, n) = mn + n for sufficiently large m and n.
which means that either a = b and c = d or a = c and d = b, as required.

Figure 2 :
Figure 2: Illustration to the proof of Claim 1.

Claim 2 :B
Let (x, y) be an occurrence of S × T -block with > l occurrences of 1, i.e., |B S,T (x, y)| 1 > l.Then for each x > x + M + S we have |B S,T (x , y)| 1 l.Symmetrically, the same holds for (x , y) with x < x − M − S and for each (x, y ) with y > y + N + T or y < y − N − T .And, symmetrically, one can replace > l with < l and obtain a similar statement.Proof of Claim 2. Assume the converse, that is, there exists x > x + M + S with |B S,T (x , y)| 1 > l.Consider an occurrence (x 1 , y 1 ) of an S × T -block with < l occurrences of 1. Due to Claim 1 applied to (x 1 , y 1 ) (a symmetric statement for < l),|B S,T (x 1 + x − x, y 1 )| 1 l.the electronic journal of combinatorics 26(4) (2019), #P4.15 S,T (x, y) B S,T (x , y )

Figure 3 :
Figure 3: Illustration to the proof of Theorem 14.