Multiset Relations: A Tool for Proving Termination
Full text
Mul ise Rela ions: a To ol o P o ing Te mina ion
?
J.-L. Ruiz-Reina, J.-A. Alonso, M.-J. Hidalgo and F.-J. Ma n
j uiz,jalonso,mjoseh, jesus
g
ia.es
Depa amen o de Cienias de la Compu aion e In eligenia A iial.
Faul ad de In o ma ia y Es ads ia, Uni e sidad de Se illa
A da. Reina Me edes, s/n. 41012 Se illa, Spain
Abs a .
We p esen in his pap e a o maliza ion o mul ise ela ions in ACL2,
and we show how mul ise s an b e used o p o e non- i ial e mina ion p op e ies
in ACL2. In ui i ely, mul ise s a e se s ha admi mul iple o u enes o elemen s.
E e y ela ion on a se
A
indues a ela ion on ni e mul ise s o e
A
and i an be
shown ha he mul ise ela ion indued by a well- ounded ela ion is also well- ounded.
We p o ed his p op e y in he ACL2 logi, and used i by un ional ins an ia ion in
o de o p o ide well- ounded ela ions o he admissibili y es o eu si e un ions.
We also de elop ed a ma o
de mul
, o dene well- ounded mul ise ela ions in an easy
way. Finally, we p esen h ee ase s udies whe e mul ise s a e used o p o e non- i ial
e mina ion p op e ies: a ail- eu si e e sion o Ake mann's un ion, a deni ion
o MCa hy's 91 un ion and a p o o o Newman's lemma o abs a edu ion
ela ions.
In o du ion
We p esen in his pap e a o maliza ion o mul ise ela ions in ACL2, and we show
how hese ela ions an b e used o p o e non- i ial e mina ion p op e ies, p o iding
a o ol o dening ela ions on ni e mul ise s and showing ha hese ela ions a e
well- ounded. Suh well- ounded ela ions a e used in he admissibili y es o eu -
si e un ions, allowing he use o p o ide a pa iula mul ise measu e in o de o
p o e e mina ion o eu si ely dened un ions.
Mul ise s a e usually dened in an in o mal way as se s wi h ep ea ed elemen s".
De showi z and Manna [4℄ p o ed ha e e y well- ounded ela ion on a se
A
indues
a well- ounded ela ion on he se o ni e mul ise s o elemen s aken om
A
. We ha e
o malized his heo em using ACL2, and s a ed i in an abs a way. This allows o
ins an ia e he heo em o show well- oundedness o on e e mul ise ela ions.
We ha e also de elop ed a ma o
de mul
in o de o easily make deni ions o
indued mul ise ela ions. Besides dening he mul ise ela ion indued by a gi en
ela ion, his ma o p o es, by un ional ins an ia ion, well- oundedness o he de-
ned mul ise ela ion, p o ided ha he o iginal ela ion is well- ounded.
The s se ion o his pap e p esen s how we ha e o malized and p o ed well-
oundedness o mul ise ela ions indued by well- ounded ela ions. The seond se-
ion p esen s he ma o
de mul
and i is shown how i an b e used o dene mul ise
well- ounded ela ions. In he h ee se ions a e ha , h ee ase s udies o in eas-
ing omplexi y a e p esen ed, showing how mul ise s an b e used o p o e non- i ial
e mina ion p op e ies. The s one is a ail- eu si e deni ion o Ake mann's
un ion. The seond one shows admissibili y o an i e a i e e sion o MCa hy's
91 un ion. The hi d one is a p o o o Newman's lemma ab ou abs a edu ion
ela ions: e mina ing and lo ally onuen edu ion ela ions a e onuen .
?
This wo k has been supp o ed by DGES/MEC: P o je s PB96-0098-C04-04 and PB96-1345
We will assume he eade has a wo king knowledge o ACL2. The b es in o du-
ion o ACL2 is [5℄. Due o he lak o spae, we will skip de ails o he mehanial
p o o s and we will no men ion gua ds o gua ds e ia ion. The omple e b o oks a e
a ailable on he web in
h p://www-s.us.es/~j uiz/al2-mul/
.
1 Fo maliza ion o mul ise ela ions in ACL2
1.1 Mul ise s: deni ions and p op e ies
A
mul ise
M
o e a se
A
is a un ion om
A
o he se o na u al numb e s. This is
a o mal way o dene se s wi h ep ea ed elemen s". In ui i ely,
M
(
x
) is he numb e
o opies o
x
2
A
in
M
. This mul ise is
ni e
i he e a e ni ely many
x
suh ha
M
(
x
)
>
0. The se o all ni e mul ise s o e
A
is deno ed as
M
(
A
).
We will use s anda d se no a ion o ep esen mul ise s. Fo example, i
A
=
a; b;
g
, an example o mul ise o e
A
is
M
=
a; b; b; b
g
, an abb e ia ion o he
un ion
M
(
a
) = 1,
M
(
b
) = 3 and
M
(
) = 0. Thus,
a; b; b; b
g
is iden ial o he
mul ise
b; b; a; b
g
, bu dis in om he mul ise
a; b; b
g
.
Basi op e a ions on mul ise s a e dened o gene alize he same op e a ions on
se s, aking in o aoun mul iple o u enes o elemen s:
x
2
M
means
M
(
x
)
>
0,
M
N
means
M
(
x
)
N
(
x
), o all
x
2
A
,
M
[
N
is he un ion
M
+
N
and
M
n
N
is he un ion
M
:
N
(whe e
x
:
y
is
x
y
i
x
y
and 0 o he wise). Fo example,
a; b; b; a
g [
; ; a; b
g
is he mul ise
a; a; a; b; b; b; ;
g
and
a; b; b; a
g n
; ; a; b
g
is
he mul ise
a; b
g
.
Any o de ing dened on a se
A
indues an o de ing on mul ise s o e
A
: gi en a
mul ise , a smalle mul ise an b e ob ained by emo ing a non-emp y subse
X
and
adding elemen s whih a e smalle han some elemen in
X
. This ons u ion an b e
gene alized o bina y ela ions in gene al, no only o pa ial o de ings. This is he
o mal deni ion:
DEFINITION 1. Gi en a ela ion
<
on a se
A
, he
mul ise ela ion
indued by
<
on
M
(
A
), deno ed as
<
mul
, is dened as
N <
mul
M
i he e exis
X ; Y
2 M
(
A
) suh
ha
; 6
=
X
M ; N
= (
M
n
X
)
[
Y
and
8
y
2
Y
9
x
2
X ; y < x
.
Fo example, i
A
=
a; b; ; d; e
g
and
b < a
,
d <
, hen
a; b; b; b; b; d; d; d; d; d; e
g
<
mul
a; a; b; ; d; e
g
by eplaing
X
=
a;
g
by
Y
=
b; b; b; d; d; d; d
g
. I an b e
easily shown ha i
<
is a s i o de ing, hen so is
<
mul
. In suh ase we alk ab ou
mul ise o de ings
.
A ela ion
<
on a se
A
is
e mina ing
i he e is no inni e de easing
1
sequene
x
0
> x
1
> x
2
:::
. An imp o an p op e y o mul ise ela ions on ni e mul ise s is
ha hey a e e mina ing when he o iginal ela ion is e mina ing, as s a ed by he
ollowing heo em:
THEOREM 1. Le
<
b e a e mina ing ela ion on a se
A
, and
<
mul
he mul ise
ela ion indued by
<
on
M
(
A
). Then
<
mul
is e mina ing.
The ab o e heo em p o ides a o ol o showing e mina ion o eu si e un ion
deni ions, by using mul ise s: show ha some mul ise measu e de eases in eah
eu si e all ompa ing mul ise s wi h esp e o he ela ion indued by a gi en e -
mina ing ela ion. In he ollowing subse ion, we explain how we o malized heo em
1 in he ACL2 logi.
1
Al hough no explii ly, we will supp ose ha he ela ions gi en he e ep esen some kind o
smalle han" ela ion.
1.2 Fo maliza ion o well- ounded mul ise ela ions in ACL2
Le us deal wi h o maliza ion o e mina ing ela ions in ACL2. A es i ed no ion o
e mina ing ela ions is buil in o ACL2 based on he ollowing me a- heo em (axiom
o hoie needed): a ela ion
<
on a se
A
is e mina ing i he e exis s a un ion
F
:
A
!
O d
suh ha
x < y
)
F
(
x
)
< F
(
y
), whe e
O d
is he lass o all o dinals.
In his ase, we also say ha he ela ion is
wel l- ounded
. No e ha we a e deno ing
he ela ion on
A
and he o de ing b e ween o dinals using he same symb ol
<
. An
a bi a y well- ounded ela ion
el
dened on a se o ob je s sa is ying a p op e y
mp
an b e dened in ACL2 as shown b elow (do s a e used o omi ehnial de ails,
as in he es o he pap e ):
(enapsula e
((mp (x) booleanp) ( el (x y) booleanp) ( n (x) e0-o dinalp))
...
(de hm el-well- ounded- ela ion-on-mp
(and (implies (mp x) (e0-o dinalp ( n x)))
(implies (and (mp x) (mp y) ( el x y))
(e0-o d-< ( n x) ( n y))))
: ule-lasses :well- ounded- ela ion))
The p edia e
mp
eognizes he kind o ob je s (alled
measu es
) ha a e o de ed
in a well- ounded way by
el
. The
embedding
un ion
n
is an o de -p ese ing
un ion mapping e e y measu e o an o dinal. One a ela ion is p o ed o sa is y
hese p op e ies and he heo em is s o ed as a well- ounded ela ion ule, i an b e
used in he admissibili y es o eu si e un ions. We all he heo em
el-well-
- ounded- ela ion-on-mp
ab o e he
wel l- oundedness heo em
o
el
,
mp
and
n
.
In ACL2, e e y pa iula well- ounded ela ion has o b e gi en by means o h ee
un ions (a bina y ela ion, a measu e p edia e and an emb edding un ion) and
he o esp onding well- oundedness heo em o suh un ions. As a pa iula ase,
when
mp
is
we an omi any e e ene o
mp
in he s a emen o he o esp onding
well- oundedness heo em. See
well- ounded- ela ion
in he ACL2 manual [6℄.
The ab o e no ion o e mina ion is es i ed: sine only o dinals up o
"
0
a e
o malized in he ACL2 logi, a limi a ion is imp osed on he maximal o de yp e
o well- ounded ela ions ha an b e o malized. Consequen ly, ou o maliza ion
sue s om he same es i ion (ne e heless, ou p o o s do no dep end on pa iula
p op e ies o
"
0
, exep well- oundedness).
Le us now deal wi h o maliza ion o mul ise s ela ions. We ep esen mul ise s
in ACL2 as ue lis s. Gi en a p edia e
(mp x)
des ibing a se
A
, ni e mul ise s
o e
A
a e des ib ed by he ollowing un ion:
(de un mp- ue-lis p (l)
(i (a om l)
(equal l nil)
(and (mp (a l)) (mp- ue-lis p (d l)))))
No e ha his un ion dep ends on he pa iula deni ion o he p edia e
mp
.
Wi h his ep esen a ion, die en ue lis s an ep esen he same mul ise : wo
ue lis s ep esen he same mul ise i one is a p e mu a ion o he o he . Thus,
he o de in whih he elemen s app ea in a lis is no ele an , bu he numb e o
o u enes o an elemen is imp o an . This mus b e aken in o aoun , o example,
when dening mul ise die ene in ACL2 ( he un ion
emo e-one
, omi ed he e,
dele es one o u ene o an elemen om a lis , whene e p ossible):
(de un mul ise -di (m n)
(i (a om n) m (mul ise -di ( emo e-one (a n) m) (d n))))
The deni ion o
<
mul
gi en in he p eeding subse ion is qui e in ui i e bu ,
due o i s many quan ie s, diÆul o implemen . Ins ead, we will use a somewha
es i ed deni ion, based on he ollowing heo em:
THEOREM 2. Le
<
b e a s i o de ing on a se
A
, and
M ; N
wo ni e mul ise s o e
A
. Then
N <
mul
M
i
M
n
N
6
=
;
and
8
n
2
N
n
M ;
9
m
2
M
n
N ;
suh ha
n < m
.
F om he ompu a ional p oin o iew, he main ad an age o his al e na i e
deni ion is ha he we do no ha e o sea h he mul ise s
X
and
Y
o he o iginal
deni ion b eause we an ake
M
n
N
and
N
n
M
, esp e i ely. I should b e ema ked
ha his equi alene is ue only when
<
is a s i pa ial o de ing. Take o example,
he ela ion
S
dened on
A
=
a; b; ; d
g
, suh ha
dS
,
S b
and
bS a
. In his ase
we ha e
b; ; d
g
S
mul
a; b;
g
, aking
X
=
a; b;
g
and
Y
=
b; ; d
g
. Ne e heless,
d
2
b; ; d
g n
a; b;
g
,
a
g
=
a; b;
g n
b; ; d
g
and i is no ue ha
dS a
.
Anyway, his is no a se e e es i ion. Mo eo e , well- oundedness o
<
mul
also
holds when his es i ed deni ion is used, e en i he ela ion
<
is no ansi i e,
as we will see. Thus, gi en a dened (o ons ained) bina y ela ion
el
, we dene
he indued ela ion on mul ise s based on his al e na i e deni ion:
(de un exis s- el-bigge (x l)
(ond ((a om l) nil)
(( el x (a l)) )
( (exis s- el-bigge x (d l)))))
(de un o all-exis s- el-bigge (l m)
(i (a om l)
(and (exis s- el-bigge (a l) m)
( o all-exis s- el-bigge (d l) m))))
(de un mul- el (n m)
(le ((m-n (mul ise -di m n))
(n-m (mul ise -di n m)))
(and (onsp m-n) ( o all-exis s- el-bigge n-m m-n))))
Finally, le us see how we an o malize in he ACL2 logi he heo em 1 ab o e,
whih s a es well- oundedness o he ela ion
mul- el
. As said b e o e, in o de o
es ablish well- oundedness o a ela ion in ACL2, in addi ion o he ela ion (
mul- el
in his ase), we ha e o gi e he measu e p edia e and he emb edding un ion, and
hen p o e he o esp onding well- oundedness heo em. Sine
mul- el
is in ended o
b e dened on mul ise s o elemen s sa is ying
mp
, hen
mp- ue-lis p
is he measu e
p edia e in his ase. Le us supp ose we ha e dened a sui able emb edding un ion
alled
map- n-e0-o d
. Then heo em 1 is o malized as ollows:
(de hm mul ise -ex ension-o - el-well- ounded
(and (implies (mp- ue-lis p x)
(e0-o dinalp (map- n-e0-o d x)))
(implies (and (mp- ue-lis p x)
(mp- ue-lis p y)
(mul- el x y))
(e0-o d-< (map- n-e0-o d x) (map- n-e0-o d y))))
: ule-lasses :well- ounded- ela ion)
In he nex subse ion we show a sui able deni ion o
map- n-e0-o d
and de-
s ib e some asp e s o he ACL2 p o o o his heo em.
1.3 A p o o o well- oundedness o he mul ise ela ion
In he li e a u e [1℄, heo em 1 is usually p o ed using Konig's lemma: e e y inni e
and ni ely b anhed ee has an inni e pa h. Ne e heless, we ha e o nd a die -
en p o o in ACL2, dening an o de -p ese ing emb edding un ion
map- n-e0-o d
om
mp- ue-lis p
ob je s o
e0-o dinalp
ob je s. Thus, ou p o o is based on
he ollowing esul om o dinal heo y: gi en an o dinal
, he se
M
(
) o ni e
mul ise s o elemen s o
(o dinals less han
), o de ed by he mul ise ela ion
indued by he o de b e ween o dinals, is o de -isomo phi o he o dinal
!
and he
isomo phism is gi en by he un ion
H
whe e
H
(
1
;::: ;
n
g
) =
!
1
+
:::
+
!
n
.
This esul an b e p o ed using Can o 's no mal o m o o dinals and i s p op e ies.
As a by-p o du , an in e es ing p op e y ab ou mul ise well- ounded ela ions
an b e dedued. Sine
"
0
implies
!
!
"
0
=
"
0
, his means ha one an always
p o e, in he ACL2 logi, well- oundedness o he mul ise ela ion indued by a gi en
well- ounded ACL2 ela ion (i.e., using emb eddings in he o dinal
"
0
). This is no
he ase, o example, o lexiog aphi p o du s, sine he maximal o dinal yp e o a
lexiog aphi p o du o wo ACL2 well- ounded ela ions may b e g ea e han
"
0
.
The isomo phism
H
ab o e sugges s he ollowing deni ion o he emb edding
un ion
map- n-e0-o d
: gi en a mul ise o elemen s sa is ying
mp
, apply
n
o e e y
elemen o ob ain a mul ise o o dinals. Then apply
H
o ob ain an o dinal less
han
"
0
. I o dinals a e ep esen ed in ACL2 no a ion, hen he un ion
H
an b e
easily dened, p o ided ha he un ion
n
e u ns always a non-ze o o dinal: he
un ion
H
simply has o so he o dinals in he mul ise and add 0 as he nal
d
.
These onside a ions lead us o he ollowing deni ion o he emb edding un ion
map- n-e0-o d
. No e ha he non-ze o es i ion on
n
is easily o e ome, dening
( he ma o)
n1
equal o
n
exep o in ege s, whe e
1
is added. In his way
n1
e u ns non-ze o o dinals o e e y measu e ob je and i is o de -p ese ing i and
only i
n
is.
(de un inse -e0-o d-< (x l)
(ond ((a om l) (ons x l))
((no (e0-o d-< x (a l))) (ons x l))
( (ons (a l) (inse -e0-o d-< x (d l))))))
(de un add1-i -in ege (x) (i (in ege p x) (1+ x) x))
(de ma o n1 (x) `(add1-i -in ege ( n ,x)))
(de un map- n-e0-o d (l)
(i (onsp l)
(inse -e0-o d-< ( n1 (a l)) (map- n-e0-o d (d l)))
0))
One
map- n-e0-o d
has b een dened, le us now deal wi h he ACL2 me-
hanial p o o o he well- oundedness heo em o
mul- el
,
mp- ue-lis p
and
map- n-e0-o d
as s a ed a he end o subse ion 1.2 by
mul ise -ex ension-o -
- el-well- ounded
. The s pa o he heo em, whih es ablishes ha
(map- n-
-e0-o d x)
is an o dinal when
(mp- ue-lis p x)
, i is no diÆul , and an b e
p o ed in ACL2 wi h mino help o m he use . The ha d pa o he heo em is o
show ha
map- n-e0-o d
is o de -p ese ing. He e is an in o mal p o o ske h:
P o o ske h:
Le us deno e, o simplii y, he un ions
n1
and
map- n-e0-o d
,
as
and
mul
, and he ela ion
el
,
mul- el
and
e0-o d-<
as
<
el
,
<
mul
and
<
,
esp e i ely. Le
M
and
N
b e wo mul ise s o
mp
elemen s suh ha
N <
mul
M
. We
ha e o p o e ha
mul
(
N
)
<
mul
(
M
). We an apply indu ion on he numb e o
elemen s o
N
. No e ha
M
an no b e emp y, and i
N
is emp y he esul i ially
holds. So le us supp ose ha
M
and
N
a e no emp y. Le
(
x
),
(
y
) b e he bigges
elemen s o
[
N
℄ and
[
M
℄, esp e i ely. No e ha
(
x
) and
(
y
) a e he
a
elemen s
o
mul
(
N
) and
mul
(
M
), esp e i ely. Sine
(
x
) and
(
y
) a e o dinals, h ee ases
may a ise:
1.
(
x
)
<
(
y
). Then, by deni ion o
<
, we ha e
mul
(
N
)
<
mul
(
M
).
2.
(
x
)
>
(
y
). This is no p ossible: in ha ase
x
is in
N
n
M
and by he mul ise
ela ion deni ion, exis s
z
in
M
n
N
suh ha
x <
el
z
. Consequen ly
(
z
)
>
(
x
)
>
(
y
). This on adi s he a ha
(
y
) is he bigges elemen o
[
M
℄.
3.
(
x
) =
(
y
). In ha ase,
x
2
M
, sine o he wise i would exis
z
2
M
n
N
suh
ha
x <
el
z
and he same on adi ion as in he p e ious ase app ea s. Le
M
0
=
M
n
x
g
and
N
0
=
N
n
x
g
. We ha e
N
0
<
mul
M
0
and, in addi ion,
mul
(
N
0
)
and
mul
(
M
0
) a e he
d
o
mul
(
N
) and
mul
(
M
), esp e i ely. Indu ion hy-
p o hesis an b e applied he e o onlude ha
mul
(
N
0
)
<
mul
(
M
0
) and he e o e
mul
(
N
)
<
mul
(
M
)
:
u
To lead ACL2 o he ab o e in o mal p o o ske h, an indu ion sheme mus b e
supplied as hin . This is a un ion sugges ing suh indu ion sheme ( he un ion
max- n1-lis
, omi ed he e, e u ns he elemen o a gi en lis wi h he g ea es
alue o
n1
):
(de un indu ion-mul ise (n m)
(dela e (xa gs :measu e (al2::len n)))
(ond ((a om n) (i (a om m) 1 2))
((a om m) 3)
( (le * ((max-m (max- n1-lis m)) (max-n (max- n1-lis n))
( n1-max-m ( n1 max-m)) ( n1-max-n ( n1 max-n)))
(ond ((equal n1-max-m n1-max-n)
(i (membe max-n m)
(indu ion-mul ise ( emo e-one max-n n)
( emo e-one max-n m))
5))
((e0-o d-< n1-max-n n1-max-m) 6)
((e0-o d-< n1-max-m n1-max-n) 7)
( 8))))))
Using his indu ion sheme we p o ed he ollowing heo em, whih is he ha d
pa o he heo em
mul ise -ex ension-o - el-well- ounded
.
(de hm map- n-e0-o d-o de -p ese ing
(implies (and (mp- ue-lis p n) (mp- ue-lis p m)
(mul- el n m))
(e0-o d-< (map- n-e0-o d n) (map- n-e0-o d m)))
:hin s (("Goal" :indu (indu ion-mul ise n m)))))
The p o o o his esul was no easy: lemmas o handle eah o he ases gene a ed
by he ab o e indu ion sheme ha e o b e p o ed, ob aining a mehanial p o o e y
lose o he p e ious p o o ske h. See he b o ok
mul ise .lisp
in he web page o
de ails ab ou he mehanial p o o .
Well- oundedness o
mul- el
has b een p o ed in an abs a amewo k, wi h-
ou assuming any pa iula p op e ies o
el
,
mp
and
n
, exep hose one ning
well- oundedness. This allows us o un ionally ins an ia e he heo em in o de o
es ablish well- oundedness o he mul ise ela ion indued by any gi en well- ounded
ACL2 ela ion. We de elop ed a ma o named
de mul
in o de o mehanize his
p o ess o un ional ins an ia ion. The ollowing se ion des ib es he ma o.
2 The
de mul
ma o and he
mul ise
b o ok
We dened a ma o
de mul
in o de o p o ide a on enien way o dene he mul ise
ela ion indued by a well- ounded ela ion, and o dela e he o esp onding well-
ounded ela ion ule. We explain now how
de mul
is used.
Le us supp ose we ha e a p e iously dened (o ons ained) ela ion
my- el
, whih
is known o b e well- ounded on a se o ob je s sa is ying he measu e p op e y
my-mp
and jus ied by he emb edding un ion
my- n
. Tha is o say, he ollowing heo em,
using a iables
x
and
y
, has b een p o ed (and s o ed as a well- ounded ela ion ule):
(de hm
heo em-name
(and (implies (
my-mp x
) (e0-o dinalp (
my- n x
)))
(implies (and (
my-mp x
) (
my-mp y
) (
my- el x y
))
(e0-o d-< (
my- n x
) (
my- n y
))))
: ule-lasses :well- ounded- ela ion))
In o de o dene he (well- ounded) mul ise ela ion indued by
my- el
, we w i e
he ollowing ma o all:
(de mul (
my- el heo em-name my-mp my- n x y
))
The expansion o his ma o gene a es a numb e o ACL2 o ms. You may use he
ACL2
ans1
ommand in o de o iew he ansla ed o m o a
de mul
all. The
main non-lo al e en s gene a ed by his ma o all a e:
{
he deni ions needed o he mul ise ela ion indued by
my- el
: un ions
exis-
s-
my- el
-bigge
,
o all-exis s-
my- el
-bigge
, and
mul-
my- el
analogous
o he un ions gi en in subse ion 1.2.
{
he deni ion o he mul ise measu e p op e y,
my-mp
- ue-lis p
.
{
he deni ion o
map-
my- n
-e0-o d
, he emb edding un ion om mul ise s o
o dinals.
{
he well- oundedness heo em o
mul-
my- el
,
my-mp
- ue-lis p
and
map-
my-
- n
-e0-o d
. This heo em is p o ed by un ional ins an ia ion om
mul ise -
-ex ension-o - el-well- ounded
and is named
mul ise -ex ension-o -
my-
- el
-well- ounded
We exp e
de mul
o wo k wi hou assis ane om he use . A e he ab o e all o
de mul
, he un ion
mul-
my- el
is dened as a well- ounded ela ion on mul ise s o
elemen s sa is ying he p op e y
my-mp
, indued by he well- ounded ela ion
my- el
.
F om his momen on,
mul-
my- el
an b e used in he admissibili y es o eu si e
un ions o show ha he eu sion e mina es.
To know he lis o names we need o supply o a
de mul
all, we ha e de elop ed
a o ol o ex a he in o ma ion om he ACL2 wo ld and p in i . This ma o is
simply alled in his way:
(de mul-omponen s
my- el
)
This is only an in o ma i e o ol, no a e en . This ma o lo oks up he ACL2 wo ld,
and e u ns he lis o names ha a e needed in he
de mul
all o
my- el
.
We ha e di ided he esul s and o ols ab ou mul ise s in o wo b o oks. The b o ok
mul ise .lisp
on ains he p o o o he heo em
mul ise -ex ension-o - el-
-well- ounded
shown in subse ion 1.3. Names in his b o ok a e dened in he pakage
MUL
. The b o ok
de mul.lisp
on ains he ma o deni ions o
de mul
and
de mul-
-omponen s
and inludes he
mul ise
b o ok. See he web page o de ails.
We ha e also inluded some non-lo al ules in
mul ise .lisp
, whih help ed us
o p o e he h ee examples p esen ed in his pap e , and we hink hey a e gene al
enough o assis in o he ases. Two ele an examples o hese addi ional esul s and
o ols a e:
{
We ha e dened he un ion
equal-se
as an equi alene ela ion. This un ion
implemen s equali y o se s, no o mul ise s, bu i u ned ou use ul in ou
ase s udies b eause i an b e p o ed o b e a ong uene wi h esp e o b o h
a gumen s o
o all-exis s-
my- el
-bigge
:
(de un equal-se (x y) (and (subse p x y) (subse p y x)))
(de equi equal-se )
(de ong equal-se i o all-exis s-
my- el
-bigge l m 1)
(de ong equal-se i o all-exis s-
my- el
-bigge l m 2)
Sine he la e wo ong uene ules dep end on he pa iula deni ion o
my- el
,
hey a e gene a ed by e e y pa iula all o
de mul
.
{
We also dene a me a ule o deal wi h die ene o mul ise s ep esen ed by lis s
wi h nal ommon suÆx. This ule ew i es exp essions o he o m
(mul ise -di (lis *
x
1
x
2
: : : x
m
l) (lis *
y
1
y
2
: : : y
k
l))
o he ollowing equi alen exp ession (wi h esp e o
equal-se
):
(mul ise -di (lis
x
1
x
2
: : : x
m
) (lis
y
1
y
2
: : : y
k
))
This me a ule is e y use ul
2
when p o ing ha a pa iula mul ise measu e
de eases in e e y eu si e all o a un ion: i is usual" ha he mul ise
ob ained measu ing he a gumen s o a eu si e all is a lis wi h he same nal
pa han he mul ise ob ained measu ing he a gumen s in he o iginal all.
3 Case s udies using mul ise ela ions
In he nex subse ions, we show h ee examples whe e well- ounded mul ise ela ions
play an imp o an ole in he ACL2 p o o o non- i ial e mina ion p op e ies. The
s example is aken om [4℄. We use a mul ise ela ion o show e mina ion o
a ail- eu si e e sion o Ake mann's un ion. In he seond example, also aken
om [4℄, we use a mul ise ela ion o admi an i e a i e e sion o MCa hy's 91
un ion. The hi d example is a p o o o Newman's lemma o abs a edu ion
sys ems: e e y e mina ing and lo ally onuen edu ion ela ion has he Chu h-
Rosse p op e y. This las example is pa o a la ge p o je de elop ed by he au ho s
in o de o o malize some asp e s o equa ional easoning using ACL2 [8, 9℄.
All he examples show one un ion whose e mina ion is p o ed using a well-
ounded mul ise ela ion and a mul ise measu e un ion. When he un ion is
p esen ed o he s ime, i s o de is ommen ed (using semiolons), o emphasize
ha a sui able measu e has s ill o b e gi en in o de o pass he admissibili y es .
3.1 A ail- eu si e e sion o Ake mann's un ion
The ollowing is he s anda d deni ion o Ake mann's un ion in ACL2:
(de un ak (m n)
(dela e (xa gs :measu e (ons (+ (n ix m) 1) (n ix n))))
(ond ((zp m) (+ n 1))
((zp n) (ak (- m 1) 1))
( (ak (- m 1) (ak m (- n 1))))))
We now y o dene he ollowing i e a i e p og am o ompu e Ake man's
un ion:
; (de un ak-i -aux (S z)
; (i (endp S)
; z
; (le ((head ( i s S))
2
Due o a bug in ACL2 e sion 2.5, his me a ule ails o b e applied. This is no he ase in e sion
2.4, whe e we o iginally de elop ed his wo k. The p oblem in e sion 2.5 an b e xed by inluding
a pa h ha will b e inluded in Ve sion 2.6. Thanks o Ma Kau mann o he pa h.
;;; (a) A well- ounded pa ial o de :
(enapsula e
(( el (x y) ) ( n (x) ))
...
(de hm el-well- ounded- ela ion
(and (e0-o dinalp ( n x))
(implies ( el x y) (e0-o d-< ( n x) ( n y))))
: ule-lasses (:well- ounded- ela ion : ew i e))
(de hm el- ansi i e
(implies (and ( el x y) ( el y z)) ( el x z))))
;;; (b) A e mina ing and loally on luen edu ion ela ion:
(enapsula e
((legal (x u) boolean) ( edue-one-s ep (x u) elemen )
( eduible (x) boolean) ( ans o m-loal-peak (x) p oo ))
....
(de un p oo -s ep-p (s)
(le ((el 1 (el 1 s)) (el 2 (el 2 s))
(ope a o (ope a o s)) (di e (di e s)))
(and ( -s ep-p s)
(implies di e (and (legal el 1 ope a o )
(equal ( edue-one-s ep el 1 ope a o )
el 2)))
(implies (no di e ) (and (legal el 2 ope a o )
(equal ( edue-one-s ep el 2 ope a o )
el 1))))))
(de un equi -p (x y p)
(i (endp p)
(equal x y)
(and (p oo -s ep-p (a p)) (equal x (el 1 (a p)))
(equi -p (el 2 (a p)) y (d p)))))
(de hm e mina ing
(implies (legal x op) ( el ( edue-one-s ep x op) x)))
(de hm loally-on luen
(le (( alley ( ans o m-loal-peak p)))
(implies (and (equi -p x y p) (loal-peak-p p))
(and (s eps- alley alley) (equi -p x y alley))))))
Fig. 1.
Assump ions o Newman's lemma
pa iula shap es (
al leys
and
loal peaks
):
loal-peak-p
eognizes p o o s o he
o m
x
!
u
and
s eps- alley
eognizes p o o s o he o m
!
x
u
.
To deal wi h he assump ion o lo al onuene, no e ha a edu ion is lo ally
onuen i o e e y lo al p eak p o o he e is an equi alen alley p o o . The e o e,
in o de o s a e lo al onuene o he gene al edu ion ela ion dened, we assume
he exis ene o a un ion
ans o m-loal-peak
whih e u ns a alley p o o o
e e y lo al p eak p o o . See again i em
(b)
in gu e 1 o a s a emen o his assumed
p op e y.
Ha ing es ablished he assump ions, in o de o p o e Newman's lemma we mus
show onuene o his gene al edu ion ela ion assumed o b e e mina ing and
lo ally onuen . Ins ead o onuene, we p o e he Chu h-Rosse p op e y, whih
is equi alen . The e o e, we mus p o e ha o e e y p o o he e exis s an equi alen
alley p o o , i.e.,
we ha e o dene
a un ion
ans o m- o- alley
and p o e ha
( ans o m- o- alley p)
is a alley p o o equi alen o
p
. This is he s a emen o
Newman's lemma:
(de hm Newman-lemma
(le (( alley ( ans o m- o- alley p)))
(implies (equi -p x y p)
(and (s eps- alley alley) (equi -p x y alley)))))
A sui able deni ion o
ans o m- o- alley
and a p o o o his heo em in
ACL2 is shown in he ollowing subse ion. The ha d pa o he p o o is o show
e mina ion o
ans o m- o- alley
. I will b e done wi h he help o a well- ounded
mul ise ela ion.
An ACL2 p o o o Newman's lemma:
The p o o ommonly ound in he li e a-
u e [1℄, is done by well- ounded indu ion on he e mina ing edu ion ela ion. Ou
app oah is mo e ons u i e and is based on a p o o gi en in [7℄. We ha e o dene
a un ion
ans o m- o- alley
whih ans o ms e e y p o o in a equi alen alley
p o o . Fo ha pu p ose, we an use he un ion
ans o m-loal-peak
, assumed o
ans o m e e y lo al p eak p o o in a equi alen alley p o o . Thus, he un ion we
need is dened o i e a i ely apply
eplae-loal-peak
, (whih eplaes he s lo-
al p eak subp o o by he equi alen subp o o gi en by
ans o m-loal-peak
) un il
he e a e no lo al p eaks (heked by
exis s-loal-peak
). The ollowing is he de-
ni ion o
ans o m- o- alley
(we omi he e he deni ion o
eplae-loal-peak
and
exis s-loal-peak
):
;(de un ans o m- o- alley (p)
; (i (no (exis s-loal-peak p))
; p
; ( ans o m- o- alley ( eplae-loal-peak p))))
This un ion is no admi ed wi hou help om he use . The eason is ha when
a lo al p eak in a p o o is eplaed by an equi alen alley subp o o , he leng h o he
p o o ob ained may b e la ge han he leng h o he o iginal p o o . Ne e heless,
he key p oin he e is ha e e y elemen o he new subp o o is smalle (w. . . he
well- ounded ela ion
el
) han he g ea es elemen o he lo al p eak. I we mea-
su e a p o o as he mul ise o he elemen s in ol ed in i , hen eplaing a lo al
p eak subp o o by an equi alen alley subp o o , we ob ain a p o o wi h smalle mea-
su e wi h esp e o he well- ounded mul ise ela ion indued by
el
. The un ion
p oo -measu e
e u ns his measu e o a gi en p o o : i olle s he
el 1
elemen s
o e e y p o o s ep in a p o o .
(de un p oo -measu e (p)
(i (endp p)
nil
(ons (el 1 (a p)) (p oo -measu e (d p)))))
Using
de mul
, we dene he well- ounded ela ion
mul- el
, indued by he well-
ounded ela ion
el
in o dued in he p e ious subse ion:
(de mul ( el el-well- ounded- ela ion-on-mp n x y))
The main esul we p o ed s a es ha he p o o measu e de eases (wi h esp e
o he well- ounded ela ion
mul- el
) i a lo al-p eak is eplaed by an equi alen
alley subp o o :
(de hm ans o m- o- alley-admission
(implies (exis s-loal-peak p)
(mul- el (p oo -measu e ( eplae-loal-peak p))
(p oo -measu e p)))
: ule-lasses nil)
Wi h his heo em, admission o he un ion
ans o m- o- alley
is now p os-
sible, gi ing a sui able hin :
(de un ans o m- o- alley (p)
(dela e (xa gs :measu e (p oo -measu e p)
:well- ounded- ela ion mul- el
:hin s
(("Goal" :use
(:ins ane ans o m- o- alley-admission)))))
(i (no (exis s-loal-peak p))
p
( ans o m- o- alley ( eplae-loal-peak p))))
One
ans o m- o- alley
is admi ed (whih is he ha d pa o he heo em),
he ollowing wo heo ems a e p o ed, and his i ially implies Newman's lemma as
s a ed a he end o subse ion 3.3.
(de hm equi -p-x-y- ans o m- o- alley
(implies (equi -p x y p)
(equi -p x y ( ans o m- o- alley p))))
(de hm alley- ans o m- o- alley
(implies (equi -p x y p)
(s eps- alley ( ans o m- o- alley p))))
The mehanial p o o o Newman's lemma is he mos diÆul o he h ee exam-
ples p esen ed he e. Lemmas ha e o b e p o ed o simpli y he mul ise die enes
app ea ing in he onje u e gene a ed by he e mina ion p o o o
ans o m- o-
- alley
. See he le
newman.lisp
in he web page o de ails. We also p o ide b o oks
p o ing deidabili y o he equi alene ela ion gene a ed by a e mina ing and lo ally
onuen edu ion ela ion. To see how his esul an b e exp o ed o he s udy o
equa ional heo ies, see [9℄.
4 Conlusions
We ha e p esen ed a o maliza ion o mul ise ela ions in ACL2, showing how hey
an b e used as a o ol o p o ing non- i ial e mina ion p op e ies o eu si e un-
ions in ACL2. We ha e dened he mul ise ela ion indued by a gi en ela ion
and p o ed a heo em es ablishing well- oundedness o he mul ise ela ion indued
by a well- ounded ela ion. This heo em is o mula ed in an abs a way, so ha
un ional ins an ia ion an b e used o p o e well- oundedness o on e e mul ise
ela ions.
We ha e p esen ed also a ma o named
de mul
, implemen ed o p o ide a on e-
nien o ol o dene well- ounded mul ise ela ions indued by well- ounded ela ions.
This ma o allows he deni ion o hese mul ise ela ions in a single s ep.
Th ee ase s udies a e p esen ed, o show how his o ol an b e use ul in ob aining
p o o s o non- i ial e mina ion p op e ies o un ions dened in ACL2. The s
ase s udy is he deni ion o a ail- eu si e e sion o Ake mann's un ion. The
seond is he admissibili y o a deni ion o MCa hy's 91 un ion, and a s udy o i s
p op e ies. The hi d is a p o o o Newman's lemma o abs a edu ion ela ions.
This wo k a ose as pa o a la ge p o je , ying o o malize p op e ies o ab-
s a edu ion ela ions, equa ional heo ies and e m ew i ing sys ems [8, 9℄. In
ha wo k, ACL2 is used as a me a-logi o s udy p op e ies o a o mal p o o sys em,
namely equa ional logi. Newman's lemma is a key esul needed o p o e deidabili y
o equa ional heo ies gi en by omple e e m ew i ing sys ems [1℄. One o malized
mul ise ela ions and used in he p o o o Newman's lemma, we deided o make a
o ol (
de mul
) whih allowed o exp o he esul s on mul ise s o o he on ex s. To
es his implemen a ion, we applied i o wo examples des ib ed in [4℄: Ake mann's
un ion and MCa hy's 91 un ion.
Fu he wo k has o b e done o p o ide a go o d lib a y o lemmas o handle mul-
ise s and hei op e a ions. We plan also o imp o e he use o
de mul
, in o de o
p o ide only he name o he well- ounded ela ion, a oiding o gi e he un ions,
a iables and e en asso ia ed wi h i . Up da ed e sions o he b o oks will b e in he
web page.
The examples p esen ed he e a e all o a heo e ial na u e. Ne e heless, a e-
ma k gi en a he end o se ion I I I in [4℄, p oin ing an heu is i p o edu e o p o ing
e mina ion o lo ops using mul ise s, sugges s ha his kind o o de ings ould b e
applied o a wide lass o e mina ion p oblems and ha he sea h o a sui able
mul ise measu e ould b e mehanized o some ex en . Ano he applia ion o mul i-
se s o de ings is o p o ide he basis o some p o o s o e mina ion o e m ew i ing
sys ems [1℄. We in end o make u he esea h ollowing hese wo lines.
Re e enes
1.
Baade , F., and Nipkow, T.
Te m ew i ing and al l ha
. Camb idge Uni e si y P ess, 1998.
2.
B ok, B.
de s u u e
o ACL2 e sion 2.0. Tehnial Rep o , 1997.
3.
Cowles, J.
Knu h's gene aliza ion o MCa hy's 91 un ion. In
Compu e -Aided Reasoning:
ACL2 Case S udies
, M. Kau mann, P. Manolios, and J S. Mo o e, Eds. Kluwe Aademi Publish-
e s, 2000, h. 17.
4.
De showi z, N., and Manna, Z.
P o ing e mina ion wi h mul ise o de ings. In
Annual
In e na ional Col loquium on Au oma a, Languages and P og amming
(1979), H. Mau e , Ed.,
no. 71 in LNCS, Sp inge -Ve lag, pp. 188{202.
5.
Kau mann, M., Manolios, P., and Moo e, J S.
Compu e -Aided Reasoning: An App oah
.
Kluwe Aademi Publishe s, 2000.
6.
Kau mann, M., and Moo e, J S.
ACL2 e sion 2.5. h p://www.s.u exas.edu/use s/mo o e-
/al2/al2-do .h ml, 2000.
7.
Klop, J.
Te m ew i ing sys ems.
Handbook o Logi in Compu e Siene
(1992).
8.
Ruiz-Reina, J., Alonso, J., Hidalgo, M., and Ma
n, F.
h p://www-s.us.es/
~
j uiz/al2-
ew . Fo malizing equa ional easoning in he ACL2 heo em p o e , 2000.
9.
Ruiz-Reina, J., Alonso, J., Hidalgo, M., and Ma
n, F.
Fo malizing ew i ing in he
ACL2 heo em p o e . In
P oeedings o AISC'2000 (Fi h In e na ional Con e ene A iial
In el ligene and Symboli Compu a ion)
( o app ea ), LNCS, Sp inge Ve lag.