K-regular sequence explained

In mathematics and theoretical computer science, a k-regular sequence is a sequence satisfying linear recurrence equations that reflect the base-k representations of the integers. The class of k-regular sequences generalizes the class of k-automatic sequences to alphabets of infinite size.

Definition

There exist several characterizations of k-regular sequences, all of which are equivalent. Some common characterizations are as follows. For each, we take R′ to be a commutative Noetherian ring and we take R to be a ring containing R′.

k-kernel

Let k ≥ 2. The k-kernel of the sequence

s(n)n

is the set of subsequences

Kk(s)=\{s(ken+r)n:e\geq0and0\leqr\leqke-1\}.

The sequence

s(n)n

is (R′, k)-regular (often shortened to just "k-regular") if the

R'

-module generated by Kk(s) is a finitely-generated R′-module.[1]

In the special case when

R'=R=Q

, the sequence

s(n)n

is

k

-regular if

Kk(s)

is contained in a finite-dimensional vector space over

Q

.

Linear combinations

\sumicij

fij
s(k

n+bij)

, where cij is an integer, fijE, and 0 ≤ bijkfij − 1.[2]

Alternatively, a sequence s(n) is k-regular if there exist an integer r and subsequences s1(n), ..., sr(n) such that, for all 1 ≤ ir and 0 ≤ ak − 1, every sequence si(kn + a) in the k-kernel Kk(s) is an R′-linear combination of the subsequences si(n).

Formal series

\sumns(n)\tau(n)

is

Z

-rational.[3]

Automata-theoretic

The formal series definition of a k-regular sequence leads to an automaton characterization similar to Schützenberger's matrix machine.[4] [5]

History

The notion of k-regular sequences was first investigated in a pair of papers by Allouche and Shallit.[6] Prior to this, Berstel and Reutenauer studied the theory of rational series, which is closely related to k-regular sequences.[7]

Examples

Ruler sequence

Let

s(n)=\nu2(n+1)

be the

2

-adic valuation
of

n+1

. The ruler sequence

s(n)n=0,1,0,2,0,1,0,3,...

is

2

-regular, and the

2

-kernel

\{s(2en+r)n:e\geq0and0\leqr\leq2e-1\}

is contained in the two-dimensional vector space generated by

s(n)n

and the constant sequence

1,1,1,...

. These basis elements lead to the recurrence relations

\begin{align} s(2n)&=0,\\ s(4n+1)&=s(2n+1)-s(n),\\ s(4n+3)&=2s(2n+1)-s(n), \end{align}

which, along with the initial conditions

s(0)=0

and

s(1)=1

, uniquely determine the sequence.[8]

Thue–Morse sequence

The Thue–Morse sequence t(n) is the fixed point of the morphism 0 → 01, 1 → 10. It is known that the Thue–Morse sequence is 2-automatic. Thus, it is also 2-regular, and its 2-kernel

\{t(2en+r)n:e\geq0and0\leqr\leq2e-1\}

consists of the subsequences

t(n)n

and

t(2n+1)n

.

Cantor numbers

The sequence of Cantor numbers c(n) consists of numbers whose ternary expansions contain no 1s. It is straightforward to show that

\begin{align} c(2n)&=3c(n),\\ c(2n+1)&=3c(n)+2, \end{align}

and therefore the sequence of Cantor numbers is 2-regular. Similarly the Stanley sequence

0, 1, 3, 4, 9, 10, 12, 13, 27, 28, 30, 31, 36, 37, 39, 40, ... of numbers whose ternary expansions contain no 2s is also 2-regular.[9]

Sorting numbers

A somewhat interesting application of the notion of k-regularity to the broader study of algorithms is found in the analysis of the merge sort algorithm. Given a list of n values, the number of comparisons made by the merge sort algorithm are the sorting numbers, governed by the recurrence relation

\begin{align} T(1)&=0,\\ T(n)&=T(\lfloorn/2\rfloor)+T(\lceiln/2\rceil)+n-1,n\geq2. \end{align}

As a result, the sequence defined by the recurrence relation for merge sort, T(n), constitutes a 2-regular sequence.[10]

Other sequences

If

f(x)

is an integer-valued polynomial, then

f(n)n

is k-regular for every

k\geq2

.

The Glaisher–Gould sequence is 2-regular. The Stern–Brocot sequence is 2-regular.

Allouche and Shallit give a number of additional examples of k-regular sequences in their papers.

Properties

k-regular sequences exhibit a number of interesting properties.

s(n)n

is k-regular, then for all integers

m\ge1

,

(s(n)\bmod{m})n

is k-automatic. However, the converse does not hold.[17]

F

is a field and

x\inF

, then the sequence of powers
n)
(x
n\ge0
is k-regular if and only if

x=0

or

x

is a root of unity.[21]

Proving and disproving k-regularity

Given a candidate sequence

s=s(n)n

that is not known to be k-regular, k-regularity can typically be proved directly from the definition by calculating elements of the kernel of

s

and proving that all elements of the form

(s(krn+e))n

with

r

sufficiently large and

0\lee<2r

can be written as linear combinations of kernel elements with smaller exponents in the place of

r

. This is usually computationally straightforward.

On the other hand, disproving k-regularity of the candidate sequence

s

usually requires one to produce a

Z

-linearly independent subset in the kernel of

s

, which is typically trickier. Here is one example of such a proof.

Let

e0(n)

denote the number of

0

's in the binary expansion of

n

. Let

e1(n)

denote the number of

1

's in the binary expansion of

n

. The sequence

f(n):=e0(n)-e1(n)

can be shown to be 2-regular. The sequence

g=g(n):=|f(n)|

is, however, not 2-regular, by the following argument. Suppose

(g(n))n

is 2-regular. We claim that the elements

g(2kn)

for

n\ge1

and

k\ge0

of the 2-kernel of

g

are linearly independent over

Z

. The function

n\mapstoe0(n)-e1(n)

is surjective onto the integers, so let

xm

be the least integer such that

e0(xm)-e1(xm)=m

. By 2-regularity of

(g(n))n

, there exist

b\ge0

and constants

ci

such that for each

n\ge0

,

\sum0cig(2in)=0.

Let

a

be the least value for which

ca\ne0

. Then for every

n\ge0

,

g(2an)=\suma+1-(ci/ca)g(2in).

Evaluating this expression at

n=xm

, where

m=0,-1,1,2,-2

and so on in succession, we obtain, on the left-hand side

g(2axm)=|e0(xm)-e1(xm)+a|=|m+a|,

and on the right-hand side,

\suma+1-(ci/ca)|m+i|.

It follows that for every integer

m

,

|m+a|=\suma+1-(ci/ca)|m+i|.

But for

m\ge-a-1

, the right-hand side of the equation is monotone because it is of the form

Am+B

for some constants

A,B

, whereas the left-hand side is not, as can be checked by successively plugging in

m=-a-1

,

m=-a

, and

m=-a+1

. Therefore,

(g(n))n

is not 2-regular.[22]

References

Notes and References

  1. Allouche and Shallit (1992), Definition 2.1.
  2. Allouche & Shallit (1992), Theorem 2.2.
  3. Allouche & Shallit (1992), Theorem 4.3.
  4. Allouche & Shallit (1992), Theorem 4.4.
  5. .
  6. Allouche & Shallit (1992, 2003).
  7. Book: Berstel . Jean . Reutenauer . Christophe . Rational Series and Their Languages . 12 . EATCS Monographs on Theoretical Computer Science . 1988 . 978-3-642-73237-9 . .
  8. Allouche & Shallit (1992), Example 8.
  9. Allouche & Shallit (1992), Examples 3 and 26.
  10. Allouche & Shallit (1992), Example 28.
  11. Allouche & Shallit (1992), Theorem 2.3.
  12. Allouche & Shallit (2003) p. 441.
  13. Allouche & Shallit (1992), Theorem 2.5.
  14. Allouche & Shallit (1992), Theorem 3.1.
  15. Allouche & Shallit (2003) p. 445.
  16. Allouche and Shallit (2003) p. 446.
  17. Allouche and Shallit (2003) p. 441.
  18. J. . Bell . A generalization of Cobham's theorem for regular sequences. Séminaire Lotharingien de Combinatoire . 54A . 2006 .
  19. A. . Cobham . On the base-dependence of sets of numbers recognizable by finite automata . Math. Systems Theory . 3 . 2 . 1969 . 186–192 . 10.1007/BF01746527 . 19792434 .
  20. Allouche & Shallit (1992) Theorem 2.10.
  21. Allouche and Shallit (2003) p. 444.
  22. Allouche and Shallit (1993) p. 168–169.