1. Introduction
In their first appearance, canonical number systems (CNSs) were natural generalizations of the positional numeral systems of rational integers to algebraic integers. D. E. Knuth, in his famous book [
1] (Ch. 4), studied the history of the radix representation of integers. He described various canonical number systems, and he proved that the complex number
is a possible base of the number system representing Gaussian integers. His result was further generalized by I. Kátai and J. Szabó. In [
2], they proved the existence of other bases, but still in the set of Gaussian integers. Later, I. Kátai and B. Kovács in [
3], B. Kovács in [
4], and B. Kovács and A. Pethő in [
5] and [
6] extended the concept of canonical number systems for the ring of algebraic integers and they proved their existence in some particular cases. In [
7], A. Pethő first used the notion, and S. Akiyama and A. Pethő in [
8] continued the development of results of CNSs over polynomials. A. Pethő and P. Varga in [
9] dealt with canonical number systems over Euclidean domains.
In [
4], a simple condition is given for the construction of CNSs, but in general, they are not easy to find. A. Kovács [
10] presented a complete description of binary canonical number systems of degrees not greater than 8. Later, P. Burcsi and A. Kovács [
11] extended the results for CNSs of degrees 9, 10, and 11.
The arithmetic in a canonical number system is similar to that of rational integers within the classical digit representation. However, calculating the digits requires a more complex reduction operation.
P. J. Grabner, P. Kirschenhofer, and H. Prodinger in [
12] introduced the concept of counting automata (increasing by 1) for Gaussian integers, which was generalized to quadratic number fields by J. M. Thuswardner [
13]. J. Allouche, K. Scheicher, and R. F. Tichy in [
14] proved the existence of addition and multiplication by a constant in algebraic number fields. K. Scheicher and J. M. Thuswaldner in [
15] introduced a fractal approach for the detailed analysis of counting automata.
Transducers were extensively studied by S. Eilenberg in Automata, Languages and Machines [
16], and further developed by W. Kuich and A. Salomaa in Semirings, Automata, Languages [
17].
In the present paper, we prove that for every CNS polynomial, an automaton can be constructed to perform digit-wise addition (Theorem 5). This relies on several assertions, which are detailed in
Section 2. We implement a program for the calculation of addition automata in binary CNSs and summarize our experiments in
Section 4.
The rest of the paper is organized as follows.
In
Section 2, we introduce the concepts and key results related to canonical number systems. We also define a useful measure for the information quantity of a polynomial and outline its fundamental properties. One of the main results of the section is Theorem 3, which establishes a general bound on geometric sums of complex numbers
with modulus greater than 1, under the condition that
is not a positive real number. The proof of this statement requires some further lemmas concerning the behavior of geometric sums, which we address in the subsequent paragraphs. Using these lemmas, we present an algorithm, which is designed to calculate a reasonably small constant appearing in Theorem 3. In the last part of the section, we prove Theorem 4, which discusses the relationship between the length of a polynomial
A in canonical representation and the information quantity of
A. The constants referenced in this theorem are derived using Theorem 3, and thus can be calculated by an algorithm explained after the theorem.
In
Section 3, we define the concept of finite transducer automata. In Theorem 5, we show that for every canonical number system, there exists a transducer automaton executing the addition operation for polynomials in canonical representation. The proof is constructive, and the automaton produced is minimal (Theorem 6). Using arguments from the previous results, in Theorem 7, we show that there is no finite transducer automaton capable of performing multiplication in canonical number systems.
In the final section, we present our experimental results regarding the construction of minimal addition automata in particular canonical number systems.
2. Definitions and Results Related to Canonical Number Systems
Definition 1. Let be a monic polynomial, be the corresponding quotient ring, and let be the homomorphism . Furthermore, let , , and let be the set of polynomials with all coefficients from . The pair is called a number system, if for any there exists a unique , such that .
The number system is called canonical, and is called a CNS polynomial if .
The length of the representation of A by P is .
Example 1. Let us consider the number system corresponding to the base-3 system.
The base-3 numeration system is, in fact, isomorphic to the polynomial system based on since the unique root of is 3. In other words, the isomorphism arises because when we substitute into any polynomial, we recover the standard evaluation in base-3.
Let us illustrate this with the constant 16 as an example:
- (a)
In the classical base-3 system, the representation of is obtained by dividing 16 by 3 repeatedly:
- 1.
with remainder units digit is 1.
- 2.
with remainder next digit is 2.
- 3.
with remainder highest digit is 1.
So we obtain the digits , i.e., .
- (b)
In the polynomial system with base , we essentially perform the same ’division with remainder’ process, but in the context of polynomials. Here, the constant 16 must be represented by a polynomial (with ) such that .
Analogously to the integer numeration system, we repeatedly divide 16 by .
- 1.
To find the last digit, we execute the ’integer’ division . Actually, we solve the equation , where . The only solution is , and . Hence, the last digit is 1, and we should represent in the system.
- 2.
For the second digit, we solve , with . The only solution is , , and .
- 3.
Finally, we should solve , with . The only solution is , , and . Since , thus there is no more carry in the computation, so the algorithm terminates.
Thus, the polynomial representation of 16 is , exactly as in the classical base-3 system.
Remark 1. Note that the system in Example 1 is not a number system in the general sense of Definition 2 since negative integers cannot be represented.
Example 2. Now, consider the base system () number, which corresponds to the polynomial . This system has the same digits , just like the base-3 system. We may observe that in the system with base , we can represent all integers, both negative and non-negative.
Express 16 once more in this numeration system:
- (a)
Again, we execute repeated division by :
- 1.
with remainder units digit is 1.
- 2.
with remainder next digit is 1.
- 3.
with remainder highest digit is 2.
So we obtain the digits , i.e., .
- (b)
In the polynomial system with base , we execute similar steps to those in the previous example. Here, the constant 16 must be represented by a polynomial (with ) such that .
- 1.
To find the last digit, we solve the equation , where . The only solution is , and . Hence, the last digit is 1, and we should represent in the system.
- 2.
For the second digit, we solve , with . The only solution is , , and .
- 3.
Finally, we should solve , with . The only solution is , , and . Since , thus there is no more carry in the computation, so the algorithm terminates.
Thus, the polynomial representation of is .
Remark 2. The system in Example 2 is indeed a valid number system since it can represent both positive and negative integers. For instance, .
Remark 3. If is a number system, then the reduced homomorphism is an isomorphism.
B. Kovács in [
4] proved that if the coefficients of
P are increasing, then there exists a corresponding canonical number system. We reformulate it in the following theorem.
Theorem 1. Let be a monic polynomial with , and be such that with . If P is not divisible by a cyclotomic polynomial, then P is a CNS polynomial.
Example 3. Let and let α be one of its roots. By Theorem 1, is a canonical number system. The corresponding numeration system of has the base α, with digits . This polynomial defines a number system over the algebraic integers, extending the idea of canonical number systems to the algebraic integers .
Now, we consider the only case when calculating the digits in the polynomial number system. Again, we want to express 16 in this system.
- 1.
To find the last digit, we solve the equation , where . The only solution is , , and . Hence, the last digit is 1, and we should represent in the system.
- 2.
For the second digit, we solve , with . The only solution is , , and .
- 3.
Next, we should solve , with . The only solution is , , and . This yields that the next digit is 0.
- 4.
Now, we should solve , with . The only solution is , , and . Hence, the next digit is again 0.
- 5.
Then, we solve , with . The only solution is , , and . The next digit is again 0.
- 6.
In the next step we solve , with . The only solution is , , and . The next digit is 2.
- 7.
Now, we solve , with . The only solution is , , and . The next digit is 1.
- 8.
Finally, we should solve , with . The only solution is , , and . Hence, the first digit is again 1, and the algorithm terminates.
The iterations of the algorithm are displayed in Table 1. Column N refers to the remaining value we should represent in the system, while q, s, and r are as in the description. We obtain that the representation of 16 in the number system is . Similarly, as before, if we set , then .
The above example illustrates how numbers in this algebraic number system can be expressed as polynomials, extending the classical notion of number systems into the realm of algebraic integers.
A. Pethő in [
7] and later Akiyama et al. [
18] have stated a necessary condition for CNS polynomials.
Theorem 2. If is a CNS polynomial, then all roots of lie outside the closed unit circle and all real roots of are less than .
Now, we define the information quantity of a polynomial. Later, at the end of this section, we will show the relation between the information quantity and the length of the canonical representation of a polynomial in Theorem 4. In
Section 3, we will use this definition in Theorem 5 for the proof of the existence of addition automata in canonical number systems.
Definition 2. Let be a CNS polynomial of degree d, be the (not necessarily different) roots of P, and let . We define the relative information quantity of A asIn the special case of A is divisible by P, we set . Example 4. Let . In the paper of A. Kovács [10], it is proven that P is a CNS polynomial. The roots of P arewhere I is the imaginary unit. The modulus of the roots are identical and equal to . Based on the properties of the logarithm, any base of the logarithm provides the same value for the relative information quantity; thus, for the sake of simplicity, let log be the base-2 logarithm. Then, (and the same is true for all the roots). - (a)
Let . Substituting the four roots to A and calculating the base-2 logarithm of the absolute value of , according to the order of the roots, we obtain the approximate values - (b)
Let . As before, execute the same operations. We obtain the logarithms of the absolute values of the substituted roots as - (c)
Let . Then, one can see that for , we obtain get exactly the same value as in case (b).
The equality of case (b) and (c) can be seen if we notice that if α is one of the roots of P, then , whence in case (b), , while in case (c) .
Lemma 1. Let be a CNS polynomial and . Then,
- (i)
;
- (ii)
If , then ;
- (iii)
;
- (iv)
;
- (v)
;
- (vi)
.
Proof.
(i) Let be an irreducible divisor of P of degree , and for the sake of simplicity, assume that are the roots of . Assume that A is not divisible by .
Since P is a CNS polynomial, by Theorem 2, for any root of P and hence for any root of as well.
is irreducible and does not divide A, thus the roots of are not roots of A, whence for all .
By definition , consequently, , whence are algebraic integers. Since , the values are algebraic integers as well.
The roots
form a complete set of algebraic conjugates over
, which means that the set
is also a complete set of algebraic conjugates over
with each value appearing in the same number. This implies that
The product of algebraic integers is an algebraic integer, hence, together with Equation (
1),
is a rational integer. If
for all
, then
which is a contradiction, whence at least one of the roots
of
is such that
.
For this
, we have
whence by definition
.
(ii) If , then , i.e., with some . This yields that for any root of P, which implies .
(iii) Let be a root of P. In the general case, when we do not assume that , we cannot state . For the sake of simplicity, assume that . Then, , which implies the statement.
(iv)–(vi) These statements can be proven by similar arguments using the additive property of the logarithm.
□
Theorem 3. Let with , and assume that α is not a positive real number. Then, there exists a constant depending only on α such that for every , and for any sequence of integers satisfying for all , we havefor any . Remark 4. In Theorem 3, we assume that , thus a natural lower bound on c can be obtained from inequality (2) if we set . Then, we havewhich implies To present this lower bound in a more expressive form, we multiply the left-hand side by . Then, we obtain Since α is not a positive real number, thus , whence the left-hand side of inequality (3) is a product of two positive numbers both less than 1. This means that there is an infimum of the possible values of c. The proof of Theorem 3 is presented later in this section, and based on the proof, we will construct an algorithm to find a proper c close to the above-mentioned infimum.
Remark 5. We consider three cases illustrating inequality (2). - (i)
(This case is excluded from Theorem 3)
If α is a positive real number, then where the last term of the right side approximates 0 as k increases and hence, for any , if k is big enough. If , then inequality (2) cannot hold for suitably large k’s. - (ii)
In the opposite extremal case, when α is a negative real number, the left-hand side of inequality (2) is maximal if we sum up the members with the same sign only. To estimate this maximum, set , and let (i.e., , if k is odd and , if k is even). Furthermore, denote by the integer part of x and set .
Because of the alternating sign of the powers of α, we have - (iii)
For the third case, when α is a nonreal complex number, we need some geometric considerations. In Figure 1, we can see an example of the first four powers of a particular complex number. Since , the modulus of the powers of α are increasing, and the arguments of the powers are integer multiples of the argument of α (denoted by ). If , then the sequence is periodic, otherwise, it is uniformly distributed in the interval and if then . It also implies that in the nonperiodic case, only if ; in other words, if and only if .
For the proof of Theorem 3, we study first the maximum of the left-hand side of inequality (2). One immediate thing we find is that if the left-hand side is maximal, then the coefficient of the largest power in the sum cannot be 0, and if a coefficient is nonzero, then it should be N (i.e., maximal itself). The latter means that to prove the general statement, it is enough to deal with geometric sums with coefficients and multiply this by N at the end.
We may geometrically depict the theorem as in Figure 2. Then, the statement can be interpreted as with some constant , depending only on α. We will also use the observation that if we denote by and the maximum of and , respectively, then .
Finally, the following property plays the most important role in proving the existence of the above-mentioned constant . Assume we have an arbitrary finite set of nonzero complex numbers . Let , such that is maximal, and let . Let e be the line with normal vector μ, i.e., . Then, B consist of those elements of A that lie on the same side of e as μ, i.e., if and only if . (see Figure 3. In the figure, μ is the sum of the complex numbers represented by solid lines.)
Before we turn to the proof of Theorem 3, we prove some lemmas, according to our observations of case (iii) of Remark 5.
First, we show that if we want to have a maximal value of the left-hand side of inequality (
2), then the most significant power of
cannot vanish.
Lemma 2. Let , with , , let be fixed integers, and Ifthen . Proof. Contrary, if
, then
which is a contradiction. □
In the next lemma and the following corollary, we prove that if and denote the possible maximum of the modulus of different length geometric sums, then is nearly proportional to . In Lemma 2, we show this property when , and in Corollary 1, we extend it for values greater than n.
Lemma 3. Let , with , , be integers, and Then, . Proof. Let
be integers, with
Then,
□
Corollary 1. With the notations of Lemma 2, let , with , where , and are integers. Then Proof. Assume first that
. Then, by Lemma 3,
Now, let
. If
, then by Lemma 3,
If
, then the proof is similar but even simpler. □
In Lemma 4, we show that the left-hand side of inequality (
2) is maximal if the nonvanishing coefficients are maximal.
Lemma 4. Let , with , , let be integers, and If , then . Proof. Let
be such that
, and
. Since
, thus
. Denote by
the complex conjugate of
x. Then,
whence
which implies
Assume that . By the maximality of M, . Conversely, , which is a contradiction. □
We may summarize the previous results in the following corollary.
Corollary 2. With the notations of Lemma 2, there exist such thatwhere . Now, we turn to the proof of our last observation of case
(iii) of Remark 5. Namely, if the left-hand side of inequality (
2) is maximal, then the coefficient of the
power in this maximal modulus sum
is nonvanishing if and only if
and
lie on the same side of the normal line
e of
. This property can be expressed by the relation
.
If we would like to represent this geometric property algebraically, we should observe that if and are nonzero complex numbers, then if and only if , or with another expression, . Here, is the real part of .
Lemma 5. Let , with , , and Furthermore, let the coefficients be chosen such thatThen, if and only if . Proof. Assume first, that
. Then,
, whence by (
4),
Now, let
. Since
can only be either 0 or 1, this means that
. Then,
, whence
, and
□
Remark 6. By the proof of Lemma 5, there is no for which . In other words, if μ is the maximal modulus subsum, then there is no power of α, which is perpendicular to μ.
Let
such that
. The two numbers determine two complementary sectors of the complex plane between
and
, and counterwise (see
Figure 4).
Corollary 3 states that if the left-hand side of inequality (
2) is the maximal modulus sum
, then there exist two different powers
and
such that all powers which are included in
lie in the same sector defined by
and
, while the powers which are not included in
lie in the other sector.
Corollary 3. With the notations of Lemma 2, let such thatand denote by be the imaginary part of . Then, there exist such that if and only if and , for all . Proof. Let ⪯ be the binary relation on
, where
if and only if
. According to the notation of
Figure 4, this means that
if and only if
y lies in the sector
. Then, for any
, the relation ⪯ is transitive on the set
Let
. Clearly,
if and only if
. Since
is a finite set, by the transitivity property, there exists not necessarily unique
such that
for all
. If
, then
, and either
or
. □
Now, we have collected everything necessary to prove Theorem 3.
Proof of Theorem 3. Let
be a sufficiently large integer, and according to the notation of Lemma 2, let
Let
Since
is not a positive real number, by Lemma 5, at least for one
i, the coefficient
, whence
. By Corollary 1,
□
The following corollary is an asymptotic extension of Theorem 3.
Corollary 4. Let with , and assume that α is not a positive real number. Let andfor all . Then, there exists depending only on α such that Proof. By Theorem 3,
for all
with some
depending only on
. By Lemma 3,
. Hence, the sequence
is an increasing bounded sequence, which implies the corollary. □
As is explained in Remark 4, there is an exact lower bound on the possible values of the constant c in Theorem 3. Based on the previous results, we can construct a fast algorithm to find a good approximation of the value of this constant. First, we slightly modify the definition of the relation introduced in the proof of Corollary 1.
Definition 3. Let ⪯ be the binary relation on , where if and only if either with some or .
Remark 7. If , then means that either or . If , then .
Remark 8. This ⪯ is a total ordering on any open half-plane (the boundary line is excluded from the plane).
Choose a sufficiently large
n and let
Sort
and
by ⪯ and glue them at both ends. Then, we obtain a cyclically sorted set
of
, where the next of
is
. The property that
is sorted means that for a given
the
is such that
is the smallest possible, i.e., the
’s are in increasing order by their argument. (If they have the same argument, then they are sorted by their modulus.)
If we want to have better constants, then we have to find an n such that is as small as it is possible.
To find c, we can use Algorithm 1 with operations on complex numbers.
The idea of the algorithm is the following:
- (1)
In the outer while loop for a given i, we compute the sum of the consecutive ’s which are contained in the open half-plane started from . Let us denote this subsum by . By Lemma 5, the maximal modulus subsum of the set of ’s will be one of .
- (2)
In the inner while loop, we rotate the half plane, and compute from by accumulating new ’s at the end and eliminating from the front.
Algorithm 1: Calculating a proper constant c of Theorem 3 |
![Algorithms 18 00122 i001]() |
In the following theorem, we prove a relation between the relative information quantity described in Definition 2 and the length of a polynomial in a CNS representation explained in Definition 1. For the calculations of the constants
, we use estimates on geometric sums of complex numbers, where Theorem 3 plays an important role. Theorem 4 will be used in
Section 3 for the proof of the existence of an addition automaton in a canonical number system.
Theorem 4. Let be a CNS polynomial. Then, there exist effectively computable constants such thatholds for every . Proof. The proof is based on the idea of [
6]. The new theorem is a more generalized form of the previous result, and its proof introduces a refined method for calculating the constants
and
. This refinement allows for more precise constants compared to earlier approaches.
Specifically, we have extended the theorem by B. Kovács and A. Pethő, offering a new method for calculating these constants with greater accuracy. The key contribution of this work is the development of an improved algorithm for determining and , leading to more exact results in the context of canonical number systems.
Let
be a CNS, with
and
with canonical representation
where
. Then,
, which means
. Assume that
is a root of
. Then, by Theorem 3,
where
depends only on
.
By Theorem 2,
validates the last inequality and makes it possible to take the logarithm of both sides. Then, we obtain
Again by Theorem 2, we may have
which can be effectively bounded from below by some
:
Taking the maximum on all roots of
P, we obtain the first inequality of (
6).
For the proof of the second inequality, set
, which denotes the upper integer part of
, and let
, where
and
. Assume that
is a root of
P. Then,
The fraction
can be bounded by an effectively computable constant depending only on
P, and by the definition of
k,
. Hence,
where
c is a constant depending only on
P. Since there exist only finitely many polynomials
with
satisfying
and these polynomials are effectively computable, we can determine
Let
. Then
□
3. Automata and Canonical Number Systems
As we have seen before, adding and multiplying by a constant are implementable with automata in CNSs. In this section, we prove that an automaton exists that executes the digit-wise addition. The existence of such an automaton is not obvious since the length of the sum of two algebraic integers represented in the canonical number system may have a shorter length than the summands’.
Definition 4. The 6-tuple is called a finite transducer automaton with k input tape if
;
S is a finite, non-empty set of states;
X is a finite set of at least two elements (the input alphabet);
Y is a finite set of at least two elements (the output alphabet);
is the initial state;
is a unique mapping.
Remark 9. We follow the convention for extending the transducer automaton to operate on words of the input alphabet and having the result as a word of the output alphabet.
In the following, if is a finite word, then we will use the notation for the corresponding polynomial.
Theorem 5. Let be a CNS. Then, there exists a finite transducer automaton with two input tapes, such that for all if .
Remark 10. In Theorem 5, we assume that the length of the words are equal. If not, we extend them with the necessary amount of 0s on the right.
Remark 11. In [19], there is a similar result, but the proof there is not constructive. Furthermore, based on our proof, we can state the minimality of our construction, as it is done in Theorem 6. Proof of Theorem 5. We prove the statement by constructing the addition automaton , where . We will define and in an appropriate way, and we will prove that S is finite. Assume that .
Let S be the smallest set such that
;
if , , , and such that then .
We define the transition function by , if .
Let
,
, and
. If
, let
be defined by
, and
. By the definition of
, we have
for all
.
Let and . Then, , , and .
Hence, by Theorem 4, and by Lemma 1(iii),
where
is the constant
in Theorem 4.
This yields that
Since
S is defined to be the smallest set satisfying (1) and (2), every
may appear as the last carry
. Thus, for all
,
, which implies that
S is finite. □
Remark 12. Observe now the properties of the states defined in the proof of Theorem 5. Let , where and . Assume that the automaton is in state A, and there are no more digits arriving from the input. Then, by the definition of the transition function δ, the output of the automaton starting from this state is the sequence . This means that different states represent different tail releases of the output, i.e., if the automaton is state , then the output without input is different to .
Theorem 6. The addition automaton, constructed in the proof of Theorem 5, is minimal.
Proof. In the definition of in the proof of the previous theorem, S is the smallest possible set satisfying the given properties. This means that for any , there exist proper inputs such that terminates in state A.
Let and , are such that terminates in state for all .
Assume that there exists an automaton , which executes the same addition as , but , i.e., has strictly fewer states. Then, by the pigeonhole principle, there exist such that and terminates in the same states. By Remark 12, automaton continues with different tail releases from the states and , but continues in the same way if there are no more input digits. This is a contradiction because we assumed that and execute the same operation. Hence, the assumption of the existence of is wrong. □
Although we can not be sure there is no linear time algorithm for multiplication, we have the following.
Theorem 7. Let be a CNS. Then, there are no finite transducer automaton S with two input tapes, such that for all if .
Proof. On the contrary, assume that executes the multiplication, and .
Let
satisfying
. Then by Lemma 1(vi), and by Theorem 4,
Set , and for all . (If , then .) Since the automaton executes the multiplication, there exist such that , and , for all .
If , then , and is determined purely by . Since , there are infinitely many different , whence there are infinitely many different corresponding states. However, this is a contradiction since we assumed that is a finite automaton. □