The paper describes MAGMA-Lisp, an extended Lisp .... ed programming systems allowing nondeterminism ..... 3rd IJCAI, Stanford 1973, pp. ... QLISP manual".
MAGMA-LISP: A "MACHINE LANGUAGE" FOR ARTIFICIAL INTELLIGENCE C. Montangero, G. P a c i n i and F. T u r i n i I s t i t u t o d i Elaborazione d e l 1 ' I n f o r m a z i o n e I s t i t u t o d i Scienze d e l l *Informazione
Abstract
the a l t e r n a t i v e s . From t h i s v i e w p o i n t , the a b i l i t y of t r a n s f e r r i n g i n f o r m a t i o n s from the c o n t e x t of an a l t e r n a t i v e to another one t u r n s out to be p a r t i c u l a r l y i m p o r t a n t . I t i s t h i s a b i l i t y , indeed, t h a t a l l o w s to s t a t e r u l e s not based upon a - p r i o r i knowledge o n l y , but a l s o upon i n f o r m a t i o n s g a t h ered at r u n - t i m e . MAGMA-Lisp has been designed in order to provide a n o n d e t e r m i n i s t i c programming frame in which these requirements are s a t i s f i e d .
The paper describes MAGMA-Lisp, an extended L i s p system proposed as an implementation t o o l f o r A . I . languages e x p l o i t i n g n o n d e t e r m i n i s t i c t e c h n i q u e s . The main idea i n f o r m i n g MAGMA-Lisp is t h a t a t r e e s t r u c t u r e of c o n c e p t u a l l y indipendent computation environments (contex t r e e ) i s the s u p p o r t i n g s t r u c t u r e of any n o n d e t e r m i n i s t i c system. MAGMA-Lisp proposes t h i s s t r u c t u r e i n a q u i t e v i r g i n a l f o r m , so t h a t the user can s t a t e h i s own techniques to prune, s e l e c t and explore the a v a i l a b l e a l t e r n a t i v e s . In t h i s sense, MAGMA-Lisp is to be viewed as a "machine language".
Systems aiming to solve the above problem have been already proposed and r e a l i z e d . It is conveni e n t to discuss b r i e f l y some c h a r a c t e r i s t i c s of the systems t h a t most i n f l u e n c e d the design of MAGMA-Lisp, i n order t o c o n t r a s t i t w i t h them.
The ideas of MAGMA-Lisp are c o n t r a s t e d w i t h the systems t h a t most i n f l u e n c e d i t s d e s i g n . The t e c h nique used in c o n t e x t implementation is d e s c r i b e d , showing how a very f l e x i b l e context mechanism can be r e a l i z e d w i t h o u t an i n t o l e r a b l e loss of e f f i c i e n cy. In p a r t i c u l a r , in s p i t e of the complexity of the system, garbage c o l l e c t i o n does not r e s u l t much more time consuming than in standard L i s p systems.
Bobrow and Wegbreit proposed a very " f l u i d " c o n t r o l s t r u c t u r e t h a t s u r e l y allows the user t o d e f i n e h i s own h e u r i s t i c s and p o l i c i e s . There is no n o t i o n of c o n t e x t , in the sense of a b u i l t - i n a b i l i t y to save the s t a t e of computations. The system provides i n s t e a d a mechanism to save the c o n t i n u a t i o n p o i n t and the anonymous p a r t i a l r e s u l t s o f procedure a c t i v a t i o n s , w h i l e the user i s in charge of r e s t o r i n g the s t a t e of the data base.
1. Introduction
CONNIVER provides a b u i l t - i n mechanism(cno t e x t frame) to save and r e s t o r e the data base i n c r e m e n t a l l y , supported by a c o n t r o l s t r u c t u r e s i m i l a r to t h a t of Bobrow and Wegbreit. The gene£ a t i o n and the d e l e t i o n of context frames are asso_ c i a t e d w i t h procedure i n v o c a t i o n s and r e t u r n s . The r e s t o r i n g mechanism appears, t h e r e f o r e , on the same l e v e l of the c o n t r q l s t r u c t u r e , w h i l e , more g e n e r a l l y , it should be able to save and r e s t o r e the c o n t r o l s t r u c t u r e i t s e l f .
Many o r i g i n a l f e a t u r e s , embedded in the l a n guages developed f o r A . I . so f a r , i n v o l v e nondeterminism < 3 . 4 , 6 , 1 2 > . I n f a c t , f e a t u r e s l i k e " p a t t e r n d i r e c t e d procedure i n v o c a t i o n " and " a s s o c i a t i v e data-base r e t r i e v a l " give r i s e t o s i t u a t i o n s i n which many p o s s i b i l i t i e s are open f o r the computat i o n to proceed. Such a f e a t u r e is t y p i c a l of nond e t e r m i n i s t i c procedures, which are c h a r a c t e r i z e d by the presence of choice p o i n t s , where the subsequent a c t i o n s are not u n i v o c a l l y determined.
Both systems appear to l a c k the mechanism t h a t , s t r i c t l y speaking, c h a r a c t e r i z e s nondetermini s t i c programming systems, i . e . the p o s s i b i l i t y to save complete "snapshots" of computations to be resumed a f t e r w a r d s if needed.
The n o n d e t e r m i n i s t i c behaviour of A . l . systems has been f i r s t r e a l i z e d by automatic b a c k t r a c k i n g . D i f f e r e n t a l t e r n a t i v e s are attempted one by one. Whenever one f a i l s , the s t a t e of the computation is a u t o m a t i c a l l y r e s t o r e d as it was before the l a s t choice was done, and a new one is a t t e m p t e d . As a matter of t e r m i n o l o g y , we say t h a t each a l t e r n a t i v e is attempted in a newly c r e a t e d c o n t e x t , w h i l e the c o n t e x t in which the choice p o i n t has been encount e r e d i s " f r o z e n " t o m a i n t a i n the s t a t e o f the computation as when the attempt b e g i n s . Automatic b a c k t r a c k i n g , although s u p e r f i c i a l l y a t t r a c t i v e , t u r n s out to be not adequate to face the main problem w i t h A . I . programming: t h a t i s , the a b i l i t y to prune the open a l t e r n a t i v e s , hopef u l l y b e e x p l o i t i n g i n f o r m a t i o n s gathered d u r i n g the execution of the program i t s e l f . In f a c t , pure b a c k t r a c k i n g f o r b i d s the programmer's i n t e r v e n t i o n in the choice p o l i c y , l i m i t i n g the system to an ex haustive search o f a l l the p o s s i b i l i t i e s and l e a d ing to i n e f f i c i e n t computations. A few f e a t u r e s , l i k e f a i l u r e messages, have been proposed since PLANNER design , to o v e r r i d e t h i s handicap. Anyway, a r e a l l y s a t i s f a c t o r y s o l u t i o n seems to r e s i d e in the design of languages in which the programmer can s t a t e h i s own r u l e s to prune, s e l e c t and explore
556
QA4 , on the o t h e r hand, appears to be some_ what unbalanced; i n f a c t , i t i s c l e a r l y o r i e n t e d towards n o n d e t e r m i n i s t i c programming, but h i s n o n d e t e r m i n i s t i c f e a t u r e are o n l y p a r t i a l l y c o n t r o l l j i b l e , and, b e s i d e s , provides a f u l l y c o n t r o l l a b l e context mechanism, t h a t , once a g a i n , does not a l l o w to save c o n t r o l i n f o r m a t i o n s . What, in our o p i n i o n , d i s t i n g u i s h e s MAGMA-Lisp system is i t s s i m p l i c i t y of c o n c e p t i o n . The main idea u n d e r l y i n g MAGMA-Lisp design is the n o t i o n of c o n t e x t , to be thought of as a complete e n v i r o n ment capable of a " d e t e r m i n i s t i c " c o m p u t a t i o n , i n c l u s i v e o f the c o n t r o l s t r u c t u r e . Nondeterminism is attained by exploring d i f f e r e n t alternatives in d i f f e r e n t contexts. Generation, d e l e t i o n , s w i t c h ing and communication among c o n t e x t s are in charge of the programmer, so t h a t the c h o i c e - p o l i c y is under u s e r ' s c o n t r o l . In o t h e r words, the user has the neat and i n t u i t i v e n o t i o n of c o n t e x t as a b a s ic programming concept: he can t h i n k of having a»
i d e n t i f i e r s of the sons of cxt and the n_-th ancest o r o f cxt i n the context t r e e , r e s p e c t i v e l y ( * ) .
many indipendent computation environments as he needs t o attempt a l l the a l t e r n a t i v e paths t o h i s g o a l . On the o t h e r hand, the system enables him to break the " a p a r t h e i d * ' among c o n t e x t s , in order to t r a n s f e r u s e f u l i n f o r m a t i o n s from one to another.
2*2 A p p l i c a t i o n s and t r e e c o n t r o l s t r u c t u r e s Each node of the context t r e e represents a computation environment, which i s e s s e n t i a l l y t h a t of a standard LISP system. That i s , adding a new node to the context t r e e r e s u l t s in c r e a t i n g a new computation environment, whose s t a t e is i n i t i a l l y a copy of i t s f a t h e r (*"*). Computation environments provided by MAGMA-Lisp d i f f e r from t h a t of standard LISP systems in what t h e i r n a t u r e has been extend to a l l o w growing a t r e e c o n t r o l s t r u c t u r e . I n o t h e r words, i n s i d e each context i t i s p o s s i b l e t o d e p a r t from the normal l a s t - i n f i r s t - o u t d i s c i p l i n e o f LISP i n order t o d e f i n e more complex c o n t r o l regimes, l i k e c o r o u t i n e s e t c .
2. MAGMA-Lisp: a user view MAGMA-Lisp has been designed as an implement a t i o n support f o r the r e a l i z a t i o n o f s o p h i s t i c a t ed programming systems a l l o w i n g nondeterminism and complex c o n t r o l regimes. This s e c t i o n sketches the main f e a t u r e s of MAGMA-Lisp, d e s c r i b i n g i t s basic c h a r a c t e r i z i n g concepts: contexts and a p p l i cations. 2 . 1 The contex t r e e I n t u i t i v e l y speaking, the s i m p l e s t v i e w p o i n t f o r the user of a n o n d e t e r m i n i s t i c language is the f o l l o w i n g one: at each c h o i c e - p o i n t c r o s s i n g , as many new computation environments are created as the a l t e r n a t i v e s to be e x p l o r e d a r e . So, a t r e e of computation environments ( c o n t e x t t r e e ) grows and c o n t r a c t s according to c h o i c e - p o i n t c r o s s i n g s and f a i l u r e s . The i n i t i a l s t a t e o f newly created cont e x t s is i d e n t i c a l to the one in which the choice p o i n t i s encountered.
The basic component of t r e e c o n t r o l s t r u c t u r e s is the a p p l i c a t i o n , which is to be viewed as a f u n c t i o n a c t i v a t i o n frame. In f a c t , an a p p l i cation contains: - a function d e f i n i t i o n ; - a l o c a l environment, i . e . b i n d i n g s and locals; - a r e t u r n p o i n t e r , i . e . the i d e n t i f i e r of the a p p l i c a t i o n to which the value of the f u n c t i o n has be r e t u r n e d ; - an environment p o i n t e r , i . e . the p o i n t e r to an association l i s t ; - a c o n t i n u a t i o n p o i n t in the a p p l i c a t i o n itself.
MAGMA-Lisp considers the c o n t e x t t r e e to be the s t r u c t u r e u n d e r l y i n g any n o n d e t e r m i n i s t i c system, b r i n g s i t t o the l i g h t and commits i t s c o n t r o l t o the u s e r . A small set of p r i m i t i v e s a l l o w s adding and dropping nodes to the c o n t e x t t r e e ; t h i s way, comp u t a t i o n environments can be created and destroyed. The f u n c t i o n n e w c x t ( c x t ) c r e a t e s a new computation environment, whose i n i t i a l s t a t e i s t h a t o f the c o n t e x t i d e n t i f i e d by c x t ( * ) . The newly created context is added to the c o n t r o l t r e e as a son of c x t . newcxt r e t u r n s the i d e n t i f i e r of the created c o n t e x t : c o n t e x t i d e n t i f i e r s are regarded as a s p e c i a l data t y p e , a l l o w i n g the e x p l i c i t management of c o n t e x t s .
An a p p l i c a t i o n A is a son of B in a t r e e c o n t r o l s t r u c t u r e i f i t s r e t u r n p o i n t e r i s the i d e n t i f i e r of B. A p p l i c a t i o n s are generated e i t h e r i m p l i c i t ly by c a l l i n g a f u n c t i o n d e f i n e d as an EXPR, or e x p l i c i t e l y by i n v o c a t i o n of a p p l y . In the former case, both the r e t u r n and the environment p o i n t e r are set according to the normal LIFU r u l e . In the l a t t e r case, both p o i n t e r s can be d e f i n e d in the i n v o c a t i o n of a p p l y . A p p l i c a t i o n i d e n t i f i e r s can be obtained by the f u n c t i o n g e t a p ( n , a p p i d ) t h a t r e t u r n s the i d e n t i f i e r of the n_-th ancestor of appid (**#) i n the c o n t r o l t r e e .
The s i z e of the context t r e e can be reduced by the f u n c t i o n c o n t r a c t ( c x t 1 , c x t 2 ) whose e f f e c t i s the s u b s t i t u t i o n o f the subtree rooted i n c x t l by the subtree rooted in c x t 2 ( * * ) .
2.3 The f u n c t i o n apply The format of t h i s f u n c t i o n r e f l e c t s the nond e t e r m i n i s t i c t r e n d o f MAGMA-Lisp. I n f a c t , i f c x t 2 i s m i s s i n g , c o n t r a c t a l l o w s t o drop c o n t e x t s a s s o c i a t e J t o f a i l e d computations, w h i l e , i f cxt2 i s not m i s s i n g and i t i s a l e a f , c o n t r a c t a l l o w s to draw the f i n a l consequence of a s u c c e s s f u l comp u t a t i o n , reducing the whole t r e e to the s i n g l e n ° d e c x t 2 . Any i n t e r m e d i a t e s t r a t e g y can be p r o grammed as w e l l .
MAGMA-Lisp is supposed to be a uniprocessor system, so, at any t i m e , there is o n l y one context i n which the computation i s proceeding ( a c t i v e c o n t e x t ) . S w i t c h i n g among d i f f e r e n t c o n t e x t s can be o b t a i n e d by a p p l y . In our system apply is g e n e r a l i z e d both to manage t r e e c o n t r o l s t r u c t u r e s and to execute s w i t c h i n g among c o n t e x t s .
The c o n t e x t t r e e can be inspected from i n s i d e any c o n t e x t , using the f u n c t i o n s s o n ( c x t ) and g e t c x t ( n , c x t ) t h a t r e t u r n the l i s t o f the context
(*)
*^ c x t is m i s s i n g , the context in which newcxt is executed is assumed.
( * * ) cxt2 must be a descendant of c x t l ; if c x t 2 i s m i s s i n g , the whole subtree rooted i n c x t l i s dropped.
(*)
I f c x t i s m i s s i n g , the context i n which the f u n c t i o n i s executed i s assumed.
(**)
I t goes w i t h o u t saying t h a t t h i s i s o n l y a u s e r ' s view. Contexts are simulated as d e scribed in sect. 3.
( * * * ) I f appid i s m i s s i n g the i d e n t i f i e r o f the a c t u a l a p p l i c a t i o n i s assumed.
557
The format of apply is the f o l l o w i n g : a p p l y ( f n , a r g i l t e n v p , r e t p . c x t ) where envp and r e t p are a p p l i c a t i o n i d e n t i f i e r s and c x t a c o n t e x t i d e n t i f i e r . I t a c t i v a t e s a new a p p l i c a t i o n t o app l y £n_ to a r g s . The new a p p l i c a t i o n is added to the c o n t r o l t r e e of context c x t as a son of r e t p , w h i l e envp d e f i n e s the environment p o i n t e r . The environment is b u i l t up appending b i n d i n g s and l o c a l s t o the a s s o c i a t i o n l i s t p o i n t e d b y a p p l i c a t i o n envp. I f the l a s t argument i s m i s s i n g , the a c t i v e c o n t e x t i s assumed.
technique is a p p l i e d throughout the whole system, c o n t r o l i n f o r m a t i o n i n c l u d e d . I n o t h e r words, t h e r e i s a unique t r e e c o n t r o l s t r u c t u r e i n the system. Any element of the t r e e may belong to more than one c o n t e x t . In such a case, the c o r r e s p o n d ing memory block may c o n t a i n a few p o i n t e r s to MVLs. T y p i c a l l y , the c o n t i n u a t i o n p o i n t is a c o n t e x t depending i n f o r m a t i o n . No s o p h i s t i c a t e d techniques have been s t u d i e d i n order t o implement the t r e e c o n t r o l s t r u c t u r e , using i n s t e a d a s t r a i g h t f o r w a r d l i s t o r g a n i z a t i o n . Whenever a f u n c t i o n is invoked ( e i t h e r i m p l i c i t l y o r e x p l i c i t l y v i a apply) a n a p p l i c a t i o n b l o c k i s a l l o c a t e d t o s t o r e basic i n f o r m a t i o n ( i . e . the f u n c t i o n d e f i n i t i o n , the r e t u r n and environment p o i n t e r s and the c o n t i n u a t i o n p o i n t ) t o g e t h e r w i t h a s u i t a b l e amount of memory f o r b i n d i n g s and l o c a l s . F i n a l l y , a u x i l i a r y memory may be a l l o c a t e d d u r i n g the computation f o r i n t e r m e d i a t e r e s u l t s .
Apply is the o n l y means to execute c o n t e x t s w i t c h i n g and to depart from the normal LIFO r u l e i n s i d e any s i n g l e c o n t e x t . Then, i t i s the b a s i c t o o l f o r the user t o c o n t r o l the n o n d e t e r m i n i s t i c f e a t u r e s of the system, and, at the same t i m e , to d e f i n e procedures t h a t e x p l o i t non-standard r e gimes of c o n t r o l . 2.4 Communications between c o n t e x t s
Memory is obtained from areas organized in f r e e l i s t s . Returning from a f u n c t i o n a p p l i c a t i o n , the corresponding memory is g i v e n back to the f r e e 1 i s t s , i n the simplest s i t u a t i o n s ; o t h e r w i s e , i t s recovery i s d e f e r r e d t o garbage c o l l e c t i o n .
C o n t e x t s , as they are p r o v i d e d by MAGMA-Lisp, must be thought of as nodes in a t r e e s t r u c t u r e of indipendent environments. The computation can proceed in the leaves as w e l l as in the o t h e r nodes. A c t i o n s in any context do not a f f e c t the s t a t e of any o t h e r , unless the programmer e x p l i c i _ t ly states the c o n t r a r i e s .
The technique of r e t e n t i o n is q u i t e s i m p l e : if an a p p l i c a t i o n A has undergone a getap (see s e t . 2 . 2 ) , A and a l l the a p p l i c a t i o n s on the path from A to the r o o t are r e t a i n e d ; r e c o v e r y , if t h a t w i l l b e the case, w i l l occur a t garbage c o l lection time.
I n f o r m a t i o n can be t r a n s f e r r e d between c o n t e x t s v i a a p p l y : i n t h i s case t h e r e i s a c o n t r o l t r a n s f e r t o o . To make i n f o r m a t i o n t r a n s m i s s i o n e a s i e r , the f u n c t i o n s put and get have been extended in MAGMA-Lisp by an a d d i t i o n a l argument, s p e c i f y i n g the context i n which p r o p e r t i e s are t o be set or i n s p e c t e d . As a r u l e , changes performed by p u t are l o c a l i z e d to a s i n g l e c o n t e x t , a c c o r d ing to the general p h i l o s o p h y . In many cases, however, it seems u s e f u l t h a t m o d i f i c a t i o n s be g l o b a l , i . e . they propagate from a c o n t e x t t o a l l i t s descendants. This happens i f the a d d i t i o n a l argument of put is a l i s t (of a s i n g l e c o n t e x t i d e n t i f i e r ) instead of a context i d e n t i f i e r .
3.1 Summary of MVL techniques Whenever a piece of i n f o r m a t i o n ( e . g . the p r o p e r t y of an atom) has d i f f e r e n t values depending on the c o n t e x t , the c e l l which should p o i n t to the v a l u e p o i n t s i n s t e a d to an MVL. An MVL is a l i s t of d o t t e d p a i r s ( c . v . ) where c is a c o n t e x t i d e n t i f i e r and j/ the v a l u e of t h e - i n f o r m a t i o n in c_. When a new c o n t e x t is c r e a t e d , no memory is a l l o c a t e d at a l l . Memory w i l l be a l l o c a t e d , by growing or g e n e r a t i n g MVLs, o n l y when u p d a t i n g is a c t u a l l y performed in t h a t c o n t e x t . Moreover, the s i z e of an MVL depends on the number of c o n t e x t s in which u p d a t i n g o c c u r r e d ; in o t h e r words, it does not depend on the number of e x i s t i n g c o n t e x t s , i . e . on the s i z e of the context t r e e .
3. Context implementation This s e c t i o n d e s c r i b e s some techniques used in the implementation of the system. The main problems t h a t have been faced have Co do w i t h the t r e e c o n t r o l s t r u c t u r e and the c o n t e x t mechanism. Here s p e c i a l emphasis is g i v e n to the s o l u t i o n s adopted to r e a l i z e the c o n t e x t mechanism.
It is fundamental t h a t MVLs are generated o n l y when they are r e a l l y needed, both w i t h r e spect to e x e c u t i o n time and memory space. There are two cases: the g l o b a l data base and the l o c a l environments. MVLs are generated to r e c o r d p r o p e r t i e s i n p r o p e r t y - l i s t s ( t h e g l o b a l d a t a base) when the c o n t e x t t r e e i s not t r i v i a l , i . e . t h e r e are more than one c o n t e x t . MVLs are generated to record items o f i n f o r m a t i o n i n l o c a l s e n v i r o n ments, o n l y i f the i n v o l v e d a p p l i c a t i o n i s t o b e r e t a i n e d even i f i t i s e x i t e d . B y t h i s simple t e c h n i q u e , MVLs are generated almost o n l y when they are r e a l l y needed.
Before d i s c u s s i n g the d e t a i l s , i t i s w o r t h to o u t l i n e the general approach used to implement MAGMA-Lisp. The system has been r e a l i z e d in two q u i t e d i s t i n c t subsequent s t e p s . F i r s t , a LISP system extended by a t r e e c o n t r o l s t r u c t u r e was implemented, then the c o n t e x t mechanism has been superimposed on t h i s basic s u p p o r t . Context mechanism is r e a l i z e d in a very simple and general way: i n f o r m a t i o n s having a c o n t e x t u a l n a t u r e are r e f e r r e d t o i n a n i n d i r e c t way, through t n u l t i d e f i n e d value l i s t s (MVL). MVLs are l i s t s p r o v i d i n g a l l the values i n the d i f f e r e n t c o n t e x t s , w i t h a technique t h a t somewhat r e c a l l s t h a t of QA4 . MVL's o r g a n i z a t i o n w i l l b e discussed i n d e t a i l s , and i t i s such t o guarantee e f f i c i e n t search and b o o k k e e p i r j This
To f i n d the v a l u e corresponding to a c o n t e x t £ in a MVL, a p a i r ( c . v ) is looked f o r f i r s t l y ; i f i t does not e x i s t s , t h e n , a c c o r d i n g l y t o t h e u s e r - v i e w o f the c o n t e x t t r e e , i t i s enough t o
558
look f o r the p a i r corresponding to the nearest ancestor o f £ . Thus, the c r u c i a l p o i n t w i t h regard t o e f f i c i e n c y i s t o f i n d a MVL o r g a n i z a t i o n c a p a b l e t o speed u p s e a r c h i n g a n e l e m e n t o r i t s n e a r e s t a n c e s t o r a c t u a l l y p r e s e n t i n t h e MVL. The f o l l o w i n g s u b s e c t i o n s d e s c r i b e a n o r g a n i z a t i o n t h a t a l l o w s t o s e a r c h and u p d a t e MVLs w i t h a satisfactory efficiency. 3 . 2 The
context
table
MAGMA-Lisp memorizes t h e c o n t e x t t r e e i n a n array ( c o n t e x t t a b l e ) indexed by context i d e n t i f i e r s . Each row s t o r e s p o i n t e r s i n o r d e r t o memor i z e the c o n t e x t t r e e as a b i n a r y t r e e . Moreover, row £ a s s o c i a t e s c o n t e x t £ w i t h a p a i r o f i n t e g e r s , t h a t w i l l b e d e n o t e d b y r ( c ) and s ( c ) : -
-
r(c)
is t h e number of nodes p r e c e e d i n g £ i n t h e p r e o r d e r t r a v e r s a l o f t h e context t r e e ; s ( c ) i s t h e r-number o f t h e l a s t d e s c e n d a n t of c in the preorder t r a v e r s a l , i . e . s ( c T i s t h e l a r g e s t r-number among c ' s descendants; s ( c ) i s set t o r ( c ) if £ has no d e s c e n d a n t s .
r-numbers and s-numbers a r e c h a r a c t e r i z e d by t h e f o l l o w i n g p r o p e r t y : g i v e n two c o n t e x t £ * and £ n , £ * i s a d e s c e n d a n t o f £ M i f and o n l y i f r ( c " ) < r ( c ' )