Rational base numeration system for p

Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Rational base numeration system for p-adic
numbers
Karel Klouda1 ,2
[email protected]
Joint work with C. Frougny
1 FIT
& FNSPE, CTU in Prague
2 LIAFA,
Université Paris 7
Mons Theoretical Computer Science Days
September 6-10, 2010, Amiens
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Motivation
Task: represent 11 in base 3 over the alphabet {0, 1, 2}, i.e., in
the form of
X
ai 3i .
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
Motivation
Greedy algorithm: from left to right
11
2
11
2
3
, r2 =
=
3 ≤ 11 < 3 → a2 = 1 =
2
2
9
3
3
a1 = 0, r1 = 2/3, a0 = 2, r0 = 0.
h11i3 = 102
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
Motivation
Greedy algorithm: from left to right
Division algorithm: from right to left
s0 = 11 = 3s1 + a0 ⇒ a0 = 2, s1 = 3
s1 = 3 = 3s2 + a1 ⇒ a1 = 0, s2 = 1
s2 = 1 = 3s3 + a0 ⇒ a2 = 1, s3 = 0
h11i3 = 102
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Division algorithm – negative numbers
Algorithm (Division Algorithm)
Given a positive s ∈ N and an integer p > 1.
1. Put s0 = s.
2. For i = 0, 1, 2 . . ., define si+1 and ai ∈ Ap = {0, 1, . . . , p − 1} by
si = psi+1 + ai .
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Division algorithm – negative numbers
Algorithm (Division Algorithm)
Given a positive s ∈ N and an integer p > 1.
1. Put s0 = s.
2. For i = 0, 1, 2 . . ., define si+1 and ai ∈ Ap = {0, 1, . . . , p − 1} by
si = psi+1 + ai .
s0 = −1 = 3s1 + a0 ⇒ a0 = 2, s1 = −1
s1 = −1 = 3s2 + a1 ⇒ a1 = 2, s2 = −1
h−1i3 = · · · 222 = ω 2
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Division algorithm – negative numbers
Algorithm (Division Algorithm)
Given a positive s ∈ N and an integer p > 1.
1. Put s0 = s.
2. For i = 0, 1, 2 . . ., define si+1 and ai ∈ Ap = {0, 1, . . . , p − 1} by
si = psi+1 + ai .
s0 = −1 = 3s1 + a0 ⇒ a0 = 2, s1 = −1
s1 = −1 = 3s2 + a1 ⇒ a1 = 2, s2 = −1
h−1i3 = · · · 222 = ω 2
We want:
−1 = 2
∞
X
i=0
3i .
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Division algorithm – rational input
Algorithm (Division Algorithm)
Given s ∈ Z and an integer p > 1.
1. Put s0 = n.
2. For i = 0, 1, 2 . . . define si+1 and ai ∈ Ap = {0, 1, . . . , p − 1} by
si = psi+1 + ai .
Then
s=
∞
X
i=0
ai p i
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Division algorithm – rational input
Algorithm (Division Algorithm)
Given
s
t
∈ Q and an integer p > 1.
1. Put s0 = n.
2. For i = 0, 1, 2 . . ., define si+1 and ai ∈ Ap = {0, 1, . . . , p − 1}
by
si
si+1
=p
+ ai .
t
t
Then
∞
s X
=
ai pi
t
i=0
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Division algorithm – rational base
Algorithm (Modified Division (MD) Algorithm)
Given
s
t
∈ Q and co-prime integers p > q ≥ 1.
1. Put s0 = n.
2. For i = 0, 1, 2 . . . define si+1 and ai ∈ Ap = {0, 1, . . . , p − 1} by
q
Then
si+1
si
=p
+ ai .
t
t
∞
s X ai
=
t
q
i=0
i
p
q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Division algorithm – rational base
Algorithm
Given
s
t
∈ Q and co-prime integers p > q ≥ 1.
1. Put s0 = n.
2. For i = 0, 1, 2 . . . define si+1 and ai ∈ Ap = {0, 1, . . . , p − 1} by
q
Then
si+1
si
=p
+ qai .
t
t
∞
s X
=
ai
t
i=0
i
p
q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
What we study
We study representations of r -adic numbers (r prime) in the forms
X
i≥−i0
i
p
,
ai
q
X
i≥−i0
p i
ai −
,
q
X ai p i
,
q q
i≥−i0
with some i0 ∈ N and ai ∈ Ap = {0, 1, . . . , p − 1}.
X ai p i
−
,
q
q
i≥−i0
Motivation
p-adic numbers
Positive integers
Negative integers
1 p -representation
q q
Rationals
p-adic absolute value
Definition
Let p be a prime number.
The p-adic valuation vp : Z \ {0} → R is given by
n = pvp (n) n0
with
p - n0 .
The extension to the set of rational numbers, for x =
vp (x) = vp (a) − vp (b).
a
b
∈Q
Motivation
p-adic numbers
Positive integers
Negative integers
1 p -representation
q q
Rationals
p-adic absolute value
Definition
Let p be a prime number.
The p-adic valuation vp : Z \ {0} → R is given by
n = pvp (n) n0
with
p - n0 .
The extension to the set of rational numbers, for x =
vp (x) = vp (a) − vp (b).
The p-adic absolute value on Q:
(
0
|x|p =
p−vp (x)
if x = 0,
otherwise.
a
b
∈Q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
p-adic absolute value – examples
Example
v3 (6) = 1
⇒
|6|3 = 3−1 , |1/6|3 = 31
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
p-adic absolute value – examples
Example
v3 (6) = 1
vp (pn ) = n
⇒
⇒
|6|3 = 3−1 , |1/6|3 = 31
|pn |p = p−n → 0 as n → ∞
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
p-adic absolute value – examples
Example
v3 (6) = 1
vp (pn ) = n
⇒
⇒
|6|3 = 3−1 , |1/6|3 = 31
|pn |p = p−n → 0 as n → ∞
p = r1j1 r2j2 · · · rkjk , q co-prime to p ⇒
(
n −ji n
p if r = ri , i ∈ {1, 2, . . . , k },
= ri
q ≥ 1 otherwise.
r
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Qp – the set of p-adic numbers I
The set of p-adic numbers Qp is defined as a completion of Q with
respect to | |p .
Theorem (Ostrowski)
Every non-trivial absolute value on Q is equivalent to the classical
absolute value | | or to one of the absolute values | |p , where p is
prime.
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Standard representation of p-adic numbers I
Theorem
Every x ∈ Qp can be uniquely written as
x
= a−i0 p−i0 + · · · + a0 + a1 p + a2 p2 + · · · + ai pi + · · ·
X
=
ai p i
i≥−i0
with ai ∈ Ap = {0, 1, . . . , p − 1} and i0 = −vp (x).
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Standard representation of p-adic numbers II
Theorem
Let x ∈ Qp . Then the standard representation of x is
1. uniquely given,
2. finite if, and only if, x ∈ N,
3. eventually periodic if, and only if, x ∈ Q.
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
MD algorithm
Algorithm (MD algorithm)
Let s be a positive integer. Put s0 = s and for all i ∈ N:
qsi = psi+1 + ai .
Return
1p
q q -expansion
of s: < s > 1 p = · · · a2 a1 a0 .
q q
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
1p
q q -expansion
Negative integers
Rationals
– properties
[Akiyama, Frougny, Sakarovitch, 2008]
• for q = 1 we get classical representation in base p,
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
1p
q q -expansion
Negative integers
Rationals
1 p -representation
q q
– properties
[Akiyama, Frougny, Sakarovitch, 2008]
• for q = 1 we get classical representation in base p,
L 1 p = {w ∈ A∗p | w is
q q
1p
-expansion of some s ∈ N}
qq
Motivation
p-adic numbers
Positive integers
1p
q q -expansion
Negative integers
Rationals
1 p -representation
q q
– properties
[Akiyama, Frougny, Sakarovitch, 2008]
• for q = 1 we get classical representation in base p,
L 1 p = {w ∈ A∗p | w is
q q
1p
-expansion of some s ∈ N}
qq
• L 1 p is prefix-closed,
q q
• L 1 p is not context-free (if q 6= 1),
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
T 1 p – tree of nonnegative integers
qq
1
2
2
0
2
1
G0
1
2
G1
0
4
3
G2
0
1
7
6
5
G3
2
0
1
11
10
9
8
G4
Children of the vertex n are given by q1 (pn + a) ∈ N, a ∈ Ap .
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
MD algorithm – the negative case
Let s be a negative integer. The q1 qp -expansion of s is
< s > 1 p = · · · a2 a1 a0 from the MD algorithm:
q q
s0 = s,
qsi = psi+1 + ai .
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
MD algorithm – the negative case
Let s be a negative integer. The q1 qp -expansion of s is
< s > 1 p = · · · a2 a1 a0 from the MD algorithm:
q q
s0 = s,
qsi = psi+1 + ai .
Properties of (si )i≥0 :
(i) (si )i≥1 is negative,
p−1
(ii) if si < − p−q
, then si < si+1 ,
p−1
p−1
(iii) if − p−q
≤ si < 0, then − p−q
≤ si+1 < 0.
− p−1
p−q
0
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
In which fields does it work?
k kX
−1
ai p i
p
+
s = sk
q
q q
i=1
We want:
kX
−1
p k
ai p i s −
= |sk |r →0
q q q i=1
r
r
as k → ∞
Hence, if p = r1j1 r2j2 · · · rkjk , the q1 qp -expansion of s “works” only in
Qri , i = 1, . . . , k . The speed of convergence is then ≈ r −ji k .
Motivation
p-adic numbers
Positive integers
1p
q q -expansions
Negative integers
Rationals
1 p -representation
q q
of negative integers
Proposition
Let k be a positive integer, and denote B =
j
p−1
p−q
k
. Then:
(i) if k ≤ B, then < −k > 1 p = ω b with b = k (p − q),
q q
(ii) otherwise, < −k > 1 p = ω bw with w ∈ A+
p and b = B(p − q).
q q
Motivation
p-adic numbers
Positive integers
1p
q q -expansions
Negative integers
1 p -representation
q q
Rationals
of negative integers
Proposition
Let k be a positive integer, and denote B =
j
p−1
p−q
k
. Then:
(i) if k ≤ B, then < −k > 1 p = ω b with b = k (p − q),
q q
(ii) otherwise, < −k > 1 p = ω bw with w ∈ A+
p and b = B(p − q).
q q
2
−4
1
−3
2
0
0
1
1
2
−2
−1
0
1
0
2
3
4
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
T 1 p – tree of negative integers
qq
p = 3, q = 2
1
T q1 pq
2
2
ω
0
ω
1
ω
2
0
2
1
1
2
0
4
3
0
1
7
6
5
2
0
1
11
10
9
8
-1
-2
0
-3
1
-4
2
0
-5
-6
1
2
0
-7
-8
-9
T q1 pq
1
2
0
1
-10
-11
-12
-13
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
Trees T 1 p and T 1 p
qq
qq
11
7
2
p = 8, q = 5
6
7
ω
0
ω
3
ω
6
0
5
1
2
3
2
1
4
6
5
4
5
0
3
10
9
8
7
-1
-2
1
-3
4
-4
7
2
-5
-6
5
0
3
-7
-8
-9
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
Trees T 1 p and T 1 p
qq
qq
11
7
2
p = 8, q = 5
6
7
ω
0
ω
3
ω
6
0
5
1
2
3
2
1
4
6
5
4
5
0
3
10
9
8
7
-1
-2
1
-3
4
-4
7
2
-5
-6
5
0
3
-7
-8
-9
The trees T 1 p and T 1 p are isomorphic if and only if
q q
q q
p−1
∈ Z,
p−q
i.e., B(p − q) = p − 1
1 p -representation
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
MD algorithm for rationals
Algorithm (MD algorithm)
Let x = st , s, t ∈ Z co-prime, s 6= 0, and t > 0 co-prime to p.
Put s0 = s and for all i ∈ N define si+1 and ai ∈ Ap by
q
Return the
1p
q q -expansion
si+1
si
=p
+ ai .
t
t
of x: < x > 1 p = · · · a2 a1 a0 .
q q
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
Examples
x
< x >1 p
q q
5
-5
11/4
11/8
11/5
5
-5
11/7
(si )i≥0 )
p = 3, q = 2
5, 3, 2, 1, 0, 0, . . .
-5,-3,-2,-2,-2, . . .
11,6,4,0,0, . . .
11,2,-4,-8,-8,-8, . . .
11,4,1,-1,-4,-6,-4,-6, . . .
p = 30, q = 11
11 25 5, 1, 0, 0, . . .
ω 19 8 5 -5,-2,-1,-1,. . .
ω (12 21 5) 23 13
11, 1, -5, -3, -6, -5, . . .
2101
ω 2012
201
ω 1222
ω (02)2112
abs. values
all
| |3
all
| |3
| |3
all
| |2 , | |3 , | |5
| |2 , | |3 , | |5
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
MD algorithm – properties
For the sequence (si )i≥1 from the MD algorithm we have:
(i) if s > 0 and t = 1, (si )i≥1 is eventually zero,
(ii) if s > 0 and t > 1, (si )i≥1 is either eventually zero or eventually
negative,
(iii) if s < 0, (si )i≥1 is negative,
p−1
t, then si < si+1 ,
(iv) if si < − p−q
p−1
p−1
(v) if − p−q
t ≤ si < 0, then − p−q
t ≤ si+1 < 0.
− p−1
p−q t
-1 0
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
MD algorithm – properties
For the sequence (si )i≥1 from the MD algorithm we have:
(i) if s > 0 and t = 1, (si )i≥1 is eventually zero,
(ii) if s > 0 and t > 1, (si )i≥1 is either eventually zero or eventually
negative,
(iii) if s < 0, (si )i≥1 is negative,
p−1
t, then si < si+1 ,
(iv) if si < − p−q
p−1
p−1
(v) if − p−q
t ≤ si < 0, then − p−q
t ≤ si+1 < 0.
Proposition
Let x ∈ Q. Then < x > 1 p is eventually periodic with period <
q q
p−1
p−q t.
Motivation
p-adic numbers
Positive integers
Negative integers
1p
q q -representation
Rationals
1 p -representation
q q
I
Definition
A left infinite word · · · a−`0 +1 a−`0 , `0 ∈ N, over Ap is a
1p
q q -representation of x ∈ Qr if a−`0 > 0 or `0 = 0 and
∞
X
ak p k
x=
q q
k =−`0
with respect to | |r .
If the q1 qp -representation is not finite (i.e., does not begin in infinitely
many zeros), then the sum converges if and only if r is a prime
factor of p.
Motivation
p-adic numbers
Positive integers
Number of
Negative integers
Rationals
1 p -representation
q q
1p
q q -representations
Let p = r1j1 r2j2 · · · rkjk .
Theorem
Let x ∈ Qri for some i ∈ {1, . . . , k }.
1p
q q -representation of x in Qri .
uncountably many q1 qp -representations of
(i) If k = 1, there exists a unique
(ii) If k > 1, there exist
in Qri .
x
Motivation
p-adic numbers
Positive integers
1p
q q -representations
Negative integers
1 p -representation
q q
Rationals
of rational number
Theorem
Let x ∈ Q and let i1 , . . . , i` ∈ {1, . . . , k }, ` < k , be distinct.
(i) There exist uncountably many
in all fields Qri1 , . . . , Qri` .
1p
q q -representations
1p
q q -representation which works
namely, the q1 qp -expansion < x > p .
q
(ii) There exists a unique
fields Qr1 , . . . , Qrk ;
(iii) The
1p
q q -expansion
which work
< x > 1 p is the only
q q
which is eventually periodic.
in all
1p
q q -representation
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
The other representations
X
i≥−i0
i
p
,
ai
q
X
i≥−i0
p i
ai −
,
q
X ai p i
,
q q
i≥−i0
X ai p i
,
−
q
q
i≥−i0
Motivation
p-adic numbers
Positive integers
Negative integers
Rationals
1 p -representation
q q
The other representations
X
i≥−i0
i
p
,
ai
q
X
i≥−i0
p i
ai −
,
q
X ai p i
,
q q
i≥−i0
p
q -rep.
1
q
i≥−i0
integer base
rational base
1p
q q -rep.
X ai p i
,
−
q
q
− pq -rep.
− pq -rep.
finite conversion by finite sequential transducer
infinite conversion by on-line algorithm
p-rep.
(−p)-rep.