Sei sulla pagina 1di 39

Integer Arithmetic

Syntax and Semantics


The integer arithmetic (IA) is the rst order theory of integer numbers.
The alphabet of the integer arithmetic consists of:
function symbols +, , S (S is the successor function n n + 1)
constant symbol 0
The semantics of IA is dened in the structure N = N, +, , n n + 1).
Examples
The order relation is dened as x y : z .x + y = z
The set of even numbers is dened by even(x) : y . x = y + y
The divisibility relation is dened as x[y : z . y = xz
The set of prime numbers is dened by
prime(x) : yz . x = yz (y = 1 z = 1)
The Conjecture of Goldbach:
x . 2 x even(x) y, z . prime(y) prime(z) x = y + z
Peano Arithmetic
An axiomatic theory is a set of formulae in which truth is derived from a
(possibly innite) set of axioms, e.g. Euclids geometry is an axiomatic
theory.
1. 0 ,= S(x)
2. S(x) = S(y) x = y
3. x + 0 = x
4. x + S(y) = S(x + y)
5. x 0 = 0
6. x S(y) = x y + x
7. (0) x . [(x) (S(x))] x . (x)
Notice that the last point denes an innite number of axioms.
Presburger Arithmetic
Denition
PA is the additive theory of natural numbers N, +)
The following relations are Presburger denable:
even(x) : y . x = y + y
x y : z . x + z = y
zero(x) : y . x y
one(x) : z . zero(z) x = z y . y = z x y
x
m
y : z . x y y x = mz x > y x y = mz
Quantier Elimination in PA
1. Eliminate the negations Replace (t
1
= t
2
) by t
1
< t
2
t
2
< t
1
,
(t
1
< t
2
) by t
1
= t
2
t
2
< t
1
, and (t
1

m
t
2
) by
_
m1
i=1
t
1

m
t
2
+ i.
Then rewrite the formula into DNF, i.e. a disjunction of x .
1
. . .
n
,
where each
i
is one of the following forms:
nx = u t
nx
m
u t
nx < u t
u t < nx
Quantier Elimination in PA
2. Uniformize the coecients of x Let p be the least common
multiple of the coecients of x. Multiply each atomic formula containing
nx by
p
n
. In particular, nx
m
u t becomes px
p
n
m
p
n
(u t).
Quantier Elimination in PA
Eliminate the coecients of x Replace all over the formula px by x
and add the new conjunct x
p
0
Special case If x = u t occurs in the formula, eliminate directly x by
replacing it with u t.
Quantier Elimination in PA
Assume x = u t does not occur. We have a formula of the form
x .
l

j=1
r
j
s
j
< x
k

i=1
x < t
i
u
i

n

i=1
x
m
i
v
i
w
i
Let M = [m
i
]
n
i=1
. The formula is equivalent to:
l

j=1
M

q=1
_
l

i=1
r
i
s
i
< (r
j
s
j
)+q
k

i=1
(r
j
s
j
)+q < t
i
u
i

n

i=1
(r
j
s
j
)+q
m
i
v
i
w
i
_
Decidability of PA
The result quantier elimination in a Presburger formula is equivalent to a
disjunction of conjunctions of atomic propositions of the following forms:
n

i=1
a
i
x
i
+ b 0
n

i=1
a
i
x
i
+ b
n
m
PA is decidable
One-dimensional Integer Sets
p-ary Expansions
Given n N, its p-ary expansion is the word w 0, 1, . . . , p 1

such
that n = w(0)p
k
+ w(1)p
k1
+ . . . + w(k)p
0
, denoted also by (n)
p
.
Note that the most signicant digit is w(0).
Conversely, to any word w 0, 1, . . . , p 1

corresponds its value


[w]
p
= w(0)p
k
+ w(1)p
k1
+ . . . + w(k)p
0
.
Notice that [w]
p
= [0w]
p
= [00w]
p
= . . ., i.e. the leading zeros dont
change the value of a word.
p-automata
We consider one-dimensional sequences s : N N.
1 2 4 8 16
p
2
: 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 . . .
Denition 1 Let p 2 be an integer. A p-automaton is a complete DFA
A = S, q
0
, T, ) over the alphabet 0, 1, . . . , p 1, whose states are
labeled with numbers from N by a function : S N.
A p-automaton denes a function f : 0, 1, . . . , p 1

N.
Notice that the nal states of a p-automaton may be designated by .
p-automata
Denition 2 A sequence s is said to be p-recognizable i there exists a
p-automaton A = S, q
0
, T, ) such that, for all n N:
q
0
(n)
p
q, and
(q) = s(n)
We will always assume that any p-automaton has a loop q
0
0
q
0
.
p
2
is 2-recognizable.
p-denability
Consider the theory N, +, V
p
), where p N, and V
p
: N N is:
V
p
(0) = 1,
V
p
(x) is the greatest power of p dividing x.
P
p
(x) is true i x is a power of p, i.e. P
p
(x) : V
p
(x) = x.
x
p
y i x is a power of p and x occurs in the p-expansion of y with
coecient j:
x
j,p
y : P
p
(x) [zt . y = z +j x +t z < x (x < V
p
(t) t = 0)]
p-denability
A sequence s : N N is p-denable if, for each v rng(s) there exists a
rst-order formula
v
of N, +, V
p
) such that:
s
1
(v) = n N [ [=
v
(n)
In other words:
s(n) = v
v
(n) . n N
The sequence p
2
is 2-denable:
p
1
2
(1) = n N [ [= V
2
(n) = n
p
1
2
(0) = n N [ [= V
2
(n) ,= n
Multi-dimensional Integer Sets
p-recognizability and p-denability
Let (u, v)
_
0, 1, . . . , p 1
2
_

be a word, where u, v 0, 1, . . . , p 1

,
[u[ = [v[.
A p-automaton is dened now over
_
0, 1, . . . , p 1
2
_

.
The denitions of p-recognizability and p-denability are easily adapted to
the m-dimensional case.
p-recognizability and p-denability
Consider t : N
2
0, 1 dened as t(n, m) = 0 i for some k 0, we have
(n)
2
(k) = (m)
2
(k) = 1, and t(n, m) = 1 otherwise.
m
1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 0 1 0 0 0 0 0
1 1 1 1 0 0 0 0
1 0 0 0 1 0 0 0
1 1 0 0 1 1 0 0
1 0 1 0 1 0 1 0
1 1 1 1 1 1 1 1
n

p-recognizability and p-denability


Consider t : N
2
0, 1 dened as t(n, m) = 0 i for some k 0, we have
(n)
2
(k) = (m)
2
(k) = 1, and t(n, m) = 1 otherwise.
(5)
2
= 1 0 0
(4)
2
= 1 1 0
m
1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 0 1 0 0 0 0 0
1 1 1 1 0 0 0 0
1 0 0 0 1 0 0 0
1 1 0 0 1 1 0 0
1 0 1 0 1 0 1 0
1 1 1 1 1 1 1 1
n

p-recognizability and p-denability


Consider t : N
2
0, 1 dened as t(n, m) = 0 i for some k 0, we have
(n)
2
(k) = (m)
2
(k) = 1, and t(n, m) = 1 otherwise.
(4)
2
= 1 0 0
(3)
2
= 0 1 1
m
1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 0 1 0 0 0 0 0
1 1 1 1 0 0 0 0
1 0 0 0 1 0 0 0
1 1 0 0 1 1 0 0
1 0 1 0 1 0 1 0
1 1 1 1 1 1 1 1
n

p-recognizability and p-denability


The sequence t is 2-recognizable.
The sequence t is 2-denable:
t
1
(0) : z . z
2
x z
2
y
t
1
(1) : z . (z
2
x) (z
2
y)
p-recognizability and p-denability
Theorem 1 Let M N
m
, m 1 and p 2. Then M is p-recognizable if
and only if M is p-denable.
From Automata to Formulae
x
j,p
y i x is a power of p and the coecient of x in (y)
p
is j:
x
j,p
y : P
p
(x)[zt . y = z +j x+t z < x (x < V
p
(t)t = 0)]

p
(x) denotes the greatest power of p occurring in (x)
p
and
p
(0) = 1.

p
(x) = y : (x = 0y = 1)[P
p
(y) y x z . (P
p
(z)y < z) (x < z)]
From Automata to Formulae
Let A = S, q
0
, T, ) be a p-automaton, with : S 0, 1.
Suppose S = q
0
, q
1
, . . . , q
l1
and replace w.l.o.g. q
k
by
e
k
= 0, . . . , 1, . . . , 0) 0, 1
l
.
n
1
, . . . , n
m
) M i (n
1
)
p
, . . . , (n
m
)
p
) /(A) i exists y
1
, . . . , y
l
):
(y
1
)
p
(0), . . . , (y
l
)
p
(0)) = 1, 0, . . . , 0):

1
:
l

j=1
1
q
0
(j),p
y
j
From Automata to Formulae
(y
1
)
p
(k), . . . , (y
l
)
p
(k)) is a nal state of A, with
p
k
max
1jk

p
(x
j
):

2
:

(q)=1
l

j=1
z
q(j),p
y
j
for all 0 i < k,
(y
1
)
p
(i), . . . , (y
l
)
p
(i))
(x
1
)
p
(i),...,(x
m
)
p
(i)
(y
1
)
p
(i +1), . . . , (y
l
)
p
(i +1)):

3
: t . P
p
(t) t < z

T(q,(a
1
,...,a
m
))=q

_
l

j=1
t
q(j),p
y
j

m

j=1
t
a
j
,p
x
j

l

j=1
p t
q

(j),p
y
j
_
From Automata to Formulae

A
: y
1
. . . y
l
z . P
p
(z) z max
1jm

p
(x
j
)
1
(y
1
, . . . , y
l
)

2
(y
1
, . . . , y
l
, z)
3
(x
1
, . . . , x
m
, y
1
, . . . , y
l
, z)
From Formulae to Automata
Build automata for the atomic formulae x + y = z and V
p
(x) = y, then
compose them with union, intersection, negation and projection.
Corollary 1 The theories N, +) and N, +, V
p
) are decidable.
The Cobham-Semenov Theorem
Base Dependence
Denition 3 Two integers p, q N are said to be multiplicatively
dependent if there exist k, l 1 such that p
k
= q
l
.
Equivalently, p and q are multiplicatively dependent i there exists r 2
and k, l 1 such that p = r
k
and q = r
l
.
Base Dependence
Lemma 1 Let p, q 2 be multiplicatively dependent integers. Let m 1
and s : N
m
N be a sequence. Then s is p-recognizable i it is
q-recognizable.
p
k
-denable p-denable Let (x, y) : P
p
k(y) y V
p
(x).
We have V
p
k(x) = y (x, y) z . (x, z) z y.
We have to dene P
p
k in N, +, V
p
).
Base Dependence
P
p
k(x) : P
p
(x) y . x 1 = (p
k
1)y
Indeed, if x = p
ak
then p
k
1[x 1.
Conversely, if assume x is a power of p but not of p
k
, i.e. x = p
ak+b
, for
some 0 < b < k.
Then x 1 = p
b
(p
ak
1) + (p
b
1), and since p
k
1[x 1, we have
p
k
1[p
b
1, contradiction.
Base Dependence
p-denable p
k
-denable
V
p
k(x) = V
p
k(p
k1
x) V
p
(x) = V
p
k(x)
V
p
k(x) = V
p
k(p
k2
x) V
p
(x) = pV
p
k(x)
. . .
V
p
k(x) = V
p
k(px) V
p
(x) = p
k2
V
p
k(x)
else V
p
(x) = p
k1
V
p
k(x)
Theorem 2 (Cobham-Semenov) Let m 1, and p, q 2 be
multiplicatively independent integers. Let s : N
m
N be a sequence. If s
is p-recognizable and q-recognizable, then s is denable in N, +).
Semilinear Sets
Denitions
L(C, P) = x
0
+ x
1
+ . . . + x
m
[ x
0
C, x
1
, . . . , x
n
P for some
C, P N
n
,
An element x L(C, P) is of the form x = x
0
+

m
i=1

i
x
i
, where x
0
C,

i
N and x
i
P, for all 1 i m.
A set M N
n
is said to be linear if M = L(c, P) for c N
n
and nite
P N
n
.
A set M N
n
is said to be semilinear if M = L(C, P) for nite C, P N
n
.
A function f : N
n
N
m
is said to be linear if for all x, y N
n
we have
f(x + y) = f(x) + f(y).
Preliminaries
If u = u
1
, . . . , u
n
), v = v
1
, . . . , v
n
) N
n
, we dene u v i u(i) v(i)
for all 1 i n.
Lemma 2 Each set of pairwise incomparable elements of N
n
is nite. In
consequence, each set M N
n
has a nite number of minimal elements.
Lemma 3 Let M N
n
be a semilinear set and f : N
n
N
m
be a linear
function. Then f(M) N
m
is a semilinear set.
Let w Z
n
, u
i
, v
j
N
n
and a
i
, b
j
Z, 1 i p, 1 j q. Then there
exists nite number of minimal tuples a
1
, . . . , a
p
, b
1
, . . . , b
q
) such that:
w =
p

i=1
a
i
u
i

q

j=1
b
j
v
j
Closure Properties
Theorem 3 The class of semilinear subsets of N
n
, n 1 is eectively
closed under union, intersection and projection.
Let
A = y
1
, . . . , y
p
, z
1
, . . . , z
q
) [ x
0
+
p

i=1
y
i
x
i
= x

0
+
q

i=1
z
i
x

and
B = y
1
, . . . , y
p
, z
1
, . . . , z
q
) [
p

i=1
y
i
x
i
=
q

i=1
z
i
x

Let f : N
p+q
N
n
dened as f(y
1
, . . . , y
p
, z
1
, . . . , z
q
)) =

p
i=1
y
i
x
i
.
f is a linear function and X X

= x
0
+ f(A). We prove that A is
semilinear.
Let C and P be the sets of minimal elements of A and B 0
p+q
,
respectively. We prove that A = L(C, P).
y z A y

C . y

y z. Let y

= y z y

i=1
y

i
x
i
=
p

i=1
(y
i
y

i
)x
i
=
p

i=1
y
i
x
i

p

i=1
y

i
x
i
= (x

0
x
0
) +
q

i=1
z
i
x

i

_
(x

0
x
0
) +
q

i=1
z

i
x

=
q

i=1
(z
i
z

i
)x

i
=
q

i=1
z

i
x

i
Hence y

B. Prove that each element of B is a sum of elements of P.


Semilinear sets = Presburger-denable sets
Theorem 4 (Ginsburg-Spanier) The class of semilinear subsets of N
n
coincides with the class of Presburger denable subsets of N
n
.
Let M = L(C, P) N
k
be a semilinear set, with
C = c
1
, . . . , c
n
N
k
and P = p
1
, . . . , p
m
N
k
.
The Presburger formula dening M is:
(x
1
, . . . , x
k
) : y
1
. . . y
m
.
n

i=1
k

j=1
x
j
= c
i
+
m

j=1
y
i
p
i
Semilinear sets = Presburger-denable sets
Let (x
1
, . . . , x
k
) be a Presburger formula, i.e. a disjunction of
conjunctions of atomic propositions of the following forms:
n

i=1
a
i
x
i
+ b 0
n

i=1
a
i
x
i
+ b
n
m
Each atomic proposition describes a semilinear set, hence their
intersections and unions are again semilinear sets.
Semilinear sets are p-denable for any p 2.

Potrebbero piacerti anche