Algorithm = Logic + Control

Embed Size (px)

Citation preview

  • 7/30/2019 Algorithm = Logic + Control

    1/13

    Programming J. J. Horning

    Languages Editor

    Algorithm =Logic + ControlRobert KowalskiImperial College, London

    An algorithm can be regarded as consisting of a

    logic component, which specifies the knowledge to beused in solving problems, and a control component,

    which determines the problem-solving strategies by

    means of which that knowledge is used. The logic

    component determines the meaning of the algorithm

    whereas the control component only affects itseffkiency. The effkiency of an algorithm can often beimproved by improving the control component without

    changing the logic of the algorithm. We argue that

    computer programs would be more often correct and

    more easily improved and modified if their logic and

    control aspects were identified and separated in theprogram text.

  • 7/30/2019 Algorithm = Logic + Control

    2/13

    T h e n o t i o n th a t c o m p u t a t i o n = c o n t r o l l ed d e d u c t i o nwas f i r s t p roposed by P ay H ayes [19] and m ore recent lyby B ib e l [2] and V aug hn -P ra t t [31] . A s im i la r the s i s tha tda tabase sys tem s should be reg a rded a s cons i s ting of are la t iona l com ponent , w hich de f ines the log ic of the da ta ,and a cont ro l com ponent , which s tore s and re t r ieves i t ,h a s b e e n s u c c e s s fu l ly a r g u e d b y C o d d [ 1 0 ] . H e w i t t ' sa r g u m e n t [ 2 0 ] f o r t h e p r o g r a m m i n g l a n g u a g e P L A N -N E R , t h o u g h g e n e r a ll y re g a r d e d a s a n a r g u m e n t a g a i n s tlog ic, can a l so be rega rded a s an a rg um e nt for the the si stha t a lgor i thm s be rega rded a s cons i s t ing of bo th log icand cont ro l com ponents . In th i s pape r we sha l l exploresom e of the use fu l consequences of tha t the s i s.

    W e repre sent the ana lys i s o f an a lgor i th m A in to alogic component L, which de f ines the log ic of the a lgo-r i thm , and a con t ro l componen t C , which spec i f ie s them anner in which the de f in i t ions a re used , sym bol ica l lyb y t h e e q u a t i o nA = L + C .

    Algor i thm s for com put ing fac tor ia l s a re a s im ple exam -ple . The de f in i t ion of f ac tor ia l cons ti tu te s the log ic com -ponent of the a lgor i thm s :1 i s t h e f a c t o r i a l o f 0 ;u i s t h e f a c t o r i a l o f x + 1 ~ v i s t h e f a c t o r i a l o f x a n d u i s v t i m e s

    x + l .T h e d e f i n i t i o n c a n b e u s e d bo t tom-up to der ive a se-quenc e of a s se r tions abou t f ac tor ia l o r it can be us ed top-d o w n t o r e d u c e t h e p r o b l e m o f c o m p u t i n g t h e f a c to r i alof x + 1 to the sub problem s o f com p ut ing the f ac tor ia lof x and m ul t ip ly ing the r e su l t by x + 1 . Di f fe ren t waysof us ing the sam e de f in i t ion g ive r i se to d i f fe ren t a lgo-r i thm s . B ot tom -up use of the de f in i t ion behaves l ikei te ra t ion . Top-down use behaves l ike r ecur s ive eva lua -t ion.T h e m a n n e r i n w h i c h t h e l o g i c c o m p o n e n t i s u s e d t oso lve problem s cons t i tu te s the cont ro l com ponent . As af i rs t approx im at ion , we re s t r ic t the cont ro l com po nent Cto genera l -purpose problem -solv ing s t r a teg ie s which donot a f fec t the m eaning of the a lgor i thm as i t i s de te r -m i n e d b y t h e l o g i c c o m p o n e n t L . T h u s d i f f e r e n t a l g o -r i thm s A1 a n d A z, o b t a i n e d b y a p p l y i n g d i f f er e n t m e t h -ods o f cont ro l C x and C2 to the sam e log ic de f in i t ions L ,a re equ iva len t in the sense tha t they so lve the sam eproblem s w i th the sam e re su l ts . S ym bol ica l ly , i f A1 =L + C1 a n d Az = L + C2 , then A1 and A z are equivalent .Th e re la t ionsh ip of equ iva lence be tween a lgor i thm s , be -cause they have the sam e log ic , i s the bas i s for us inglog ica l ana lys i s to im prove the e f f i c iency of an a lgor i th mby re ta in ing i t s log ic bu t im p roving th e wa y i t is used . Inpa r t i cu la r , r ep lac ing bo t tom -up by top-down cont ro lof ten (bu t no t a lways ) im proves e f f i c iency , whereas r e -p l a c i ng t o p - d o w n s e q u e n ti a l s o l u ti o n o f s u b p r o b l e m s b ytop-d ow n pa ra l le l so lu t ion seem s neve r to decrease e f fi -c iency .

    B oth the log ic and the cont ro l com ponents of ana lgor i thm a f fec t e f f i c iency . The log ic com ponent ex-42 5

    pres se s the knowledge which can be used in so lv ingp r o b l e m s a n d t h e c o n t ro l c o m p o n e n t d e t e rm i n e s t h e w a yi n w h i c h t h a t k n o w l e d g e c a n b e u s e d . T h e d i s t i n c t i o nb e t w e e n l o g i c a n d c o n t r o l i s n o t w h o l l y u n a m b i g u o u s .Th e sam e a lgor i th m A can of ten be ana lyz ed in d i f fe ren tw a y s .A = L~ + C~.A = L z + C 2 .O n e a n a l y s i s m i g h t i n c l u d e i n t h e l o g i c c o m p o n e n t w h a tanothe r ana lys i s inc ludes in the cont ro l com ponent . Ingenera l , we pre fe r an ana lys i s which p laces the grea te s tbu rden for ach iev ing e f fi c iency on the cont ro l com po -nent . S uch an ana lys i s ha s two advantages : (1 ) the log iccom pon ent can a f ford to be a c lea rer and m ore obv ious lyc o r re c t s t a te m e n t o f th e p r o b l e m a n d t h e k n o w l e d g ewhich can be used in i t s so lu t ion and (2 ) the cont ro lcom ponent a s sum es grea te r r e spons ib i l i ty for the e f f i -c i e n c y o f th e a l g o r i t h m , w h i c h c o n s e q u e n t l y c a n b e m o r er e a d i ly i m p r o v e d b y u p g r a d i n g t h e e f f ic i e n c y o f t h econtrol .I t i s the in ten t ion tha t th i s pape r should be se l f -conta ined . The f i r s t pa r t , a ccord ingly , in t roduces thec lausa l form of pred ica te log ic and de f ines the top-d ow na n d b o t t o m - u p i n t e rp r e t at i o n s o f H o r n c l au s e s. T h e b o d yof the pap e r inves t iga te s the fo l lowing decom p os i t ion ofa lgor i thm s in to the i r va r ious com ponents .

    / / i t h mL O g c . / \A b s t r a c t O e f i n i t k ) n s o f ~ , ~ C o n t r o l c o m p o n e n tp r o c e d u r e data s t r u c t u r e sd e f i n i t i o n s re p re s e n te d b y / / ~

    D i r e c t i o n S t r a t e g y f o r S t r a t e g y f o r S c he m e f o r(e .g . top-down e x e c u t i o n o f i n v e s t i g a t i n g s t o r i n g d a t ao r b o t t o r n - u p ) i ) ro c e d u r e a l t e r n a t i v e r e p r e s e n t e dca l l s (e .g . proce dures r e la t io na l l ysequent ia l orpara l le l )W e s t u d y t h e a f fe c t o f a lt e ri n g e a c h o f t h e a b o v e c o m -ponents of an a lgor i thm . The f ina l sec t ion of the p ape rin t roduces a graphica l no ta t ion for expre s s ing , m oreform al ly than in th e r e s t o f the pape r , ce r ta in k inds ofcont ro l in form at ion . Mu ch of the m a te r ia l in th i s pape rhas been abs t rac ted f rom lec ture note s [23] prepa red fort h e a d v a n c e d s u m m e r s c h o o l o n f o u n d a t i o n s o f c o m p u t -i n g h e l d a t t h e M a t h e m a t i c a l C e n t r e i n A m s t e r d a m i nMay 1974 .N o t a t i o n

    W e use the c lausa l form of pred ica te log ic . S im pleasser t ions are expressed by clauses :Fath er (Zeu s, Ares) ~--Moth er (Hera, Ares)Father (A res, Harmonia) ~-M other (Semele, Dionisius)Father (Zeus, Dionisius)etc.Communications July 1979of Volume 22the ACM Number 7

  • 7/30/2019 Algorithm = Logic + Control

    3/13

    H e r e F a t h e r ( x , y ) s t a t es t h a t x i s th e f a t h e r o f y a n dM o t h e r ( x , y ) s t a t e s t h a t x i s t h e m o t h e r o f y .

    C l a u s e s c a n a l s o e x p r e s s g e n e r a l c o n d i t i o n a l p r o p o -si t ions:Female (x) *- Mother (x, y)Male (x) ,--- Fathe r (x, y)Parent (x, y) ~ Mothe r (x, y)Parent (x, y) ~-- Fathe r (x, y).T h e s e s t a t e t h a tx is female/f x is mother of y,x is mal e/ fx is father of y,x is parent ofy tfx is mother of y, andx is parent ofy tfx is father ofy.T h e a r r o w ~ i s t h e l og i ca l connec t i ve " i f " ; " x " a n d " y "are variables r e p r e s e nt i n g a n y i n d i v id u a l s; " Z e u s , "" A r e s , " e t c . a r e c o n s t a n t s y m b o l s r e p r e s e n t i n g p a r t i c u l a ri n d i v id u a l s; " F a t h e r , " " M o t h e r , " " F e m a l e , " et c . a r ep r e d i c a t e s y m b o l s r e p r e s e n t i n g r e l a t i o n s a m o n g i n d i v i d -u a l s . V a r i a b l e s i n d i f f e r e n t c l a u s e s a r e d i s t i n c t e v e n i ft h e y h a v e t h e s a m e n a m e s .

    A c l a u s e c a n h a v e s e v e r a l j o i n t c o n d i t i o n s o r s e v e r a la l t e r n a t i v e c o n c l u s i o n s . T h u sGran dpa ren t (x, y) ,--- Parent (x, z), Parent (z, y)Male (x), Female (x) ~-- Parent (x, y)Ancestor (x, y) ,--- Parent (x, y)Ancestor (x, y) ~ Ancestor (x, z), Ancestor (z, y)w h e r e x , y , a n d z a r e v a r i a b l e s , s t a t e t h a t f o r a l l x , y , a n dgx is grandparent ofy/f x is parent of z a n d z is parent o f y;x is male o r x is female tfx is parent of y;x is ancestor ofy tfx is parent of y; andx is ancestor ofy tfx is ancestor of z a n d z is ancestor ofy.

    P r o b l e m s t o b e s o l v e d a r e r e p r e s e n t e d b y c l a u s e sw h i c h a r e d e n i a l s . T h e c l a u s e s~-- Grandp arent (Zeus, Harmonia)

    Ancestor (Zeus, x) -- Male (x), Ancestor (x, Dionis ius)w h e r e x i s a v a r i a b l e s t a t e t h a tZeus is not grandparent of Harmonia,for no x is Zeus ancestor of x, andfor no x is x male a n d is x an ancestor of Dionisius.

    A t y p i c a l p r o b l e m - s o l v e r ( o r t h e o r e m - p r o v e r ) r e a c t st o a d e n i a l b y u s i n g o t h e r c l a u s e s t o t r y t o r e f u t e t h ed e n i a l . I f t h e d e n i d l c o n t a i n s v a r i a b l e s , t h e n i t i s p o s s i b l et o e x t r a c t f r o m t h e r e f u t a t i o n t h e v a l u e s o f t h e v a r i a b l e sw h i c h a c c o u n t f o r th e r e f u t a t i o n a n d r e p r e s e n t a s o l u t i o no f t h e p r o b l e m t o b e s o l v e d . I n t h i s e x a m p l e , d i f f e r e n tr e f u t a t i o n s o f t h e s e c o n d d e n i a l f i n d d i f f e r e n t x o f w h i c hZ e u s i s th e a n c e s t o r :x = Ares, x = Har monia , x = Dionisius.

    M o r e g e n e r a l l y , w e d e f i n e c l a u s e s a n d t h e i r i n t e r p r e -ta t ion a s fo l low s . A c l a u se i s a n e x p r e s s i o n o f t h e f o r mB h . . . , B m * - - A I , . . . , A , ~ re, n-->0,w h e r e B ~ . . . . Bi n , A 1 . . . . A n ar e a t o m s . T h e a t o m s A~ ,426

    . . . . An are cond i t i ons o f t h e c l a u s e a n d t h e a t o m s B 1 . . . ,Bm a r e a l t e r n a t i v e conc l u s i ons o f t h e c l a u s e . I f t h e c l a u s ec o n t a i n s t h e v a r i a b l e s X l . . . . X k t h e n i n t e r p r e t i t a s s t a t i n gt h a tfor all xl ... .. xkB1 or ... or Bm if A1 and ... and An.I f n = 0 , t h e n i n t e r p r e t i t a s s ta t i n g u n c o n d i t i o n a l l y t h a tfor all x~, .... xkB~ or ... or Bin.I f m = 0 , t h e n in te r p re t i t a s s t a t ing th a tfor no x~, ..., xkA ~ and ... and A n.I f m = n = O, t h e n in te rp re t t h e c la u s e a s a se n te nc ew h i c h i s a l w a y s f a l s e .

    A n a t o m ( o r a t o m i c f o r m u l a ) i s a n e x p r e s s i o n o f t h ef o r mP (h .... tn)w h e re P i s a n n -p la ce p re d i ca te s y m b o l a nd t~ , . . . , t,, a ret e r m s . I n t e r p r e t t h e a t o m a s a s s e r t i n g t h a t t h e r e l a t i o nc a l l e d P h o l d s a m o n g t h e i n d i v i d u a l s c a l l e d t~ . . . . tn .

    A t e rm i s a v a r i a b l e , a c o n s t a n t s y m b o l , o r a n e x p r e s -s i o n o f th e f o r mf ( h . . . . . t n )w h e r e f i s a n n - p l a c e f u n c t i o n s y m b o l a n d t l . . . . . tn a r et e r m s .

    T h e s e t s o f p r e d i c a t e s y m b o l s , f u n c t i o n s y m b o l s , c o n -s t a n t s ymbol s , a n d variables a r e a n y m u t u a l l y d i s j o i n ts e ts . ( B y c o n v e n t i o n , w e r e s e r v e t h e l o w e r c a s e l e t t er s u ,v , w , x , y , z , w i t h o r w i t h o u t a d o r n m e n t s , f o r v a r i a b l e s .T h e t y p e o f o t h e r k i n d s o f s y m b o l s i s i d en t i fi e d b y t h ep o s i t i o n t h e y o c c u p y i n c l a u s e s . )

    C l a u s a l f o r m h a s t h e s a m e e x p r e s s i v e p o w e r a s t h es t a n d a r d f o r m u l a t i o n o f p r e d i c a t e l o g i c . A l l v a r i a b l e s X l,. . . . Xk w h i c h o c c u r i n a c l a u s e C a r e i m p l i c i t l y g o v e r n e db y u n i v e r s a l q u a n t i f i e r s V x a . . . . V x k ( f or a ll x l a n d ...a n d f o r a l l Xk). T h u s C is a n a b b r e v i a t i o n f o rVx~ ... Vxh C.T h e e x i s t e n t i a l q u a n t i f i e r 3 x ( t h e r e e x is t s a n x ) i s a v o i d e db y u s i n g c o n s t a n t s y m b o l s o r f u n c ti o n s y m b o l s t o n a m ei n d i v i d u a l s . F o r e x a m p l e , t h e c l a u s e sFather (dad (x), x) ~ Huma n (x)Mother (mum (x), x)

  • 7/30/2019 Algorithm = Logic + Control

    4/13

    the de f in i t ion can be sy s tem at ica l ly de r ived f rom thes tandard form . I t can take cons ide rable e f for t , however ,to r ecognize the not i on of subse t in the r e su l t ing pa i r o fclauses :x C__y, ar b ( x , f l) ~ xx C C _y ~ - - a r b ( x , y ) ~ y .(Here w e have used inf ix nota t io 9 for pred ica te sym bols ,wr i t ing xP y ins tead of P(x, y) . )In th i s pape r , we sha l l avo id the awkw ardness of thec lausa l de f in i t ion of subse t by c oncent ra t ing a t ten t ion onc lauses which conta in a t the m os t one conc lus ion . S uchclauses , ca lled Horn clauses, can be fur th e r c la s s i fied in tofour k inds :a s s e r t i o n s ( o f t h e f o r m ) Bp r o c e d u r e d e c l a ra t i o n s (o f t he fo rm ) B * -- - A 1 . . . . , A nd e n i a l s ~ -- A ~ , . . . , A , ,a n d c o n t r a d i c t i o n ~ - -Asse r t ions can be rega rd ed a s the spec ia l ca se of proce -dure dec la ra t ions where n = 0 .Th e H orn c lause subse t o f log ic r esem bles conven-t iona l program m ing languages m ore c lose ly than e i the rthe fu l l c lausa l o r s tanda rd form s of log ic . F or exam ple ,the not ion of subse t can be de f ined recur s ive ly by m eansof Horn c lauses :x C y " ~ - E m p t y ( x )x _ y ~ -- S p l i t ( x , z , x ' ) z ~ y , x ' _ y .Here i t is in tended tha t the r e la t ionsh ip Em p ty (x ) ho ldswhen x i s em pty , and S pl i t (x , z , x ' ) ho lds when xcons i s ts o f e lem ent z and subse t x ' . Ho rn c lauses used inthis way, to def ine re la t ions recurs ively, are re la ted toH e r b r a n d - G r d e l r e c u r s i o n e q u a t i o n s a s d e s c r i b e d b yKleene [22] , e labora ted b y M cC ar thy [28] , em plo yed forp r o g r a m t r a n s f o r m a t i o n b y B u r s t a l l a n d D a r l i n g t o n[ 1 3 ], a n d a u g m e n t e d w i t h c o n t r o l a n n o t a t io n s b ySchwarz [34].

    Top-Down and Bottom-U p Interpretations o f HornClauses

    A typ ica l Horn c lause problem has the form of(1) a set o f c lauses wh ich de f ines a problem d om ai n

    an d(2) a theorem wh ich cons is t s o f (a ) hyp otheses repre -

    sented by a s se r t ions A1 ~ . . . . . An ~-- and (b) aconc lus ion which i s nega ted and repre sented by adenial ~--B1 . . . . Bin.

    In top-down problem -solv ing , we reason backwardsf rom the conc lus ion , r epea tedly r educ ing goa ls tosubgoa ls u n t i l eventua l ly a l l subgoa ls a re so lved d i rec t lyby the or ig ina l as se r tions . In bo t tom -up problem -solv ing ,we reason forwards f rom the hypotheses , r epea tedlyde r iv ing new as se r t ions f rom old ones un t i l eventua l lythe or ig ina l goa l i s so lved d i rec t ly b y d e r ived a s se r t ions .427

    T h e p r o b l e m o f s h o w i n g t h a t Z e u s i s a g r a n d p a r e n to f H a r m o n i a c a n b e s o l v e d e i th e r t o p - d o w n o r b o t t o m -up . Reasoning bot tom -up, we s ta r t wi th the a s se r t ionsFath er (Zeus , Ares) ~--Fath er (A res, Harm onia) ~--and use the c lause P a rent (x , y ) ~ -- F a th e r (x , y ) to de r ivenew as se r tionsParent (Zeus, A res)Parent (A res, Harmonia) ~--C o n t i n u i n g b o t t o m - u p w e d e r i v e, f r o m t h e d e f i n i t io n o fgrandparent , the new as se r t ionGrandp arent (Zeus, Harmo nia) *--which m a tches the or ig ina l goa l .Reasoning top-down, we s ta r t wi th the or ig ina l goa lo f s h o w i n g t h a t Z e u s i s a g r a n d p a r e n t o f H a r m o n i a

    Grandparent (Zeus, H armonia)and use the de f in i t ion of grand parent to de r ive two newsubgoa ls,--- Parent (Zeu s, z), Paren t (z, H armonia)b y d e n y i n g t h a t a n y z i s b o t h a c h i l d o f Z e u s a n d ap a r e n t o f H a r m o n i a . C o n t i n u i n g t o p - d o w n a n d c o n s id -e r ing bo th subgoa ls (e i the r one a t a t im e or bo th s im ul-taneous ly) , we use the c lause P a rent (x , y ) * - -F a th e r (x , y ) to r ep lace the sub problem P arent (Zeus , z )by F a the r (Zeus , z ) and the subproblem P arent (z , Har -m o n i a ) b y F a t h e r ( z , H a r m o n i a ) . T h e n e w l y d e r i v e dsubproblem s a re so lved com pa t ib ly by a s se r t ions whichde te rm ine "Ares" a s the des i r ed va lue of z .

    I n b o t h t h e t o p - d o w n a n d b o t t o m - u p s o l u t i o ns o f t h eg r a n d p a r e n t p r o b l em , w e h a v e m e n t i o n e d t h e d e r i v a t i o nof only those c lauses which d i rec t ly cont r ibu te to theeventu a l so lu t ion . In add i t ion to the de r iva t ion of re le-vant c lauses , it is o f ten unavoid able , du r ing the c our se ofsearching for a solut ion, to der ive asser t ions or subgoalswhich do not cont r ibu te to the so lu t ion . F or exam ple , inthe bo t tom -up sea rch for a so lu t ion to the grandparentproblem, i t is poss ible to der ive the ir re levant asser t ionsParent (H era, Ares) ~--M ale (Zeus}In the top-down sea rch i t i s pos s ib le to r ep lace thesubproblem P arent (Zeus , z ) by the i r r e levant and un-so lvable subproblem Mothe r (Zeus , z ) .T h e r e a r e b o t h p r o o f p r o c ed u r e s w h i c h u n d e r s t a n dlog ic top-down (e . g . m ode l e l im ina t ion [17] , S L- re so lu-t ion [20] , and in te rconnec t iv i ty graphs [35] ) a s we l l a so n e s w h i c h u n d e r s t a n d l o g ic b o t t o m - u p ( n o t a b l y h y p e r -re so lu t ion [35] ). These p roof procedures op e ra te wi th thec lausa l form of pred ica te log ic and d ea l wi th b o th H ornc l a u s e s a n d n o n - H o r n c l a u s e s . A m o n g c l a u s a l p r o o fprocedures , the connec t ion graph procedu re [25 ] i s ab let o m i x t o p - d o w n a n d b o t t o m - u p r e as o n i ng . A m o n g n o n -c lausa l pro of procedures , G entzen sys tem s [ 1 ] and B led-soe 's r e la ted na tura l d edu c t ion sys tem s [5 ] prov ide fac i l-i ti es f o r m i x i n g t o p - d o w n a n d b o t t o m - u p r e as o n i ng .Communications July 1979of Volume 22the ACM Numb er 7

  • 7/30/2019 Algorithm = Logic + Control

    5/13

    T h e t e r m i n o l o g y " t o p - d o w n " a n d " b o t t o m - u p " a p -p l ied to pro of procedu res de r ives f rom our inves t ig a t ionof the pa r s ing problem form u la ted in pred ica te log ic [23,25 ] . Given a gram m ar form ula ted in c lausa l form , top-down reasoning behaves a s a top-down pa r s ing a lgo-r i t h m a n d b o t t o m - u p r e as o n i n g b e h a v e s a s a b o t t o m - u pa l g o ri t h m . D a v i d W a r r e n ( u n p u b l i s h e d ) h a s s h o w n h o wto de f ine a genera l proof procedure for Horn c lauses ,w h i c h w h e n a p p l i e d t o t h e p a r s i n g p r o b l em , b e h a v e s l i k ethe Ear ley pa r s ing a lgor i thm [16] .

    T h e P r o c e d u r a l I n t e r p r e t a t io n o f H o r n C l a u s e sThe procedura l in te rpre ta t ion i s the top-down in te r -

    pre ta t ion . A c lause of the formB~----A~ .. .. A. n>_Ois interpreted as a procedure. T h e name o f t h e p r o c e d u r ei s the conc lus ion B wh ich ident i f ies the form of thep r o b l e m s w h i c h t h e p r o c e d u r e c a n s o l v e . T h e body o fthe procedu re i s the se t of procedure calls Ai. A clause ofthe form*--Bl .... Bm m-->Ocons i s t ing en t i r e ly of procedure ca l ls (or problem s to beso lved) behaves a s a goal statement. A p r o c e d u r eB,---A1 .... A,is invoked by a procedu re ca l l B i in the goa l s ta tem ent :(1) B y m atch ing th e ca ll B i wi th the nam e B of the

    procedure ;(2) B y rep lac ing the cal l B i wi th the bod y of the pro-

    c e d u r e o b t a i n i n g t h e n e w g o a l s t a te m e n tB1 .... Bi-l, A1, ..., An, Bi+l .... ,B m

    a n d ;( 3) B y a p p l y i n g t h e m a t c h i n g s u b s t i tu t i o n 0

    (B1 . .. . Bi-1, A1 .. .. . An, Bi+l .. .. . Bin) O.( T h e matching substitution 0 rep laces va r iab le s by te rm si n a m a n n e r w h i c h m a k e s B a n d Bi identical : BO = B,O.)Th e p a r t o f the su bs t i tu t ion 0 which a f fec t s va r iab le s inth e origin al proced ure calls B~ . . . . Bm transmits output.The pa r t which a f fec t s va r iab le s in the new procedurecalls A1 . . . . . An t r ansm i ts input.F o r e x a m p l e , i h v o k i n g t h e g r a n d p a r e n t p r o c e d u r e b ythe procedure ca l l in

    Grandparent (Zeus, H armonia)de r ives the new goa l s ta tem ent

    Parent (Zeu s, z), Parent (z, Harmonia).T h e m a t c h i n g s u b s t i t u t i o nx = Zeusy = Harmoniat ransm i ts input on ly . Invoking the a s se r t iona l procedureFather (Zeus, Ares)4211

    by the f i r s t p rocedu re ca l l in the goa l s ta tem ent~-- Fath er (Zeus, z), Parent (z, H armonia)de r ives the new goa l s ta tem ent~-- Parent (A res, Harmonia).T h e m a t c h i n g s u b s t i t u t i o nz = Arest ransm i ts ou tput on ly . In genera l , however , a s ing lep r o c e d u r e i n v o c a t i o n m a y t r a n s m i t b o t h i n p u t a n d o u t -put .T h e t o p - d o w n i n t e r p r e t a ti o n o f H o r n c l a u se s d i f fe r sin seve ra l im por tan t r e spec ts f rom procedure invoca t ioni n c o n v e n t i o n a l p r o g r a m m i n g l a ng u a g e s :(1 ) Th e body of a procedu re is a se t r a t h e r t h a n a

    sequence of procedure ca ll s . Th i s m eans th a t p ro-cedure ca l l s can be executed in any sequence or inparalle l .( 2) M o r e t h a n o n e p r o c e d u r e c a n h a v e a n a m e w h i c hm a t c h e s a g i v e n p r o c ed u r e c a l l. F i n d i n g t h e " r i g h t "procedure i s a sea rch problem which can be so lvedby t ry ing the d i f fe ren t procedures in sequence , inpa ra l le l , o r in o the r m ore s ophis t i ca ted w ays .

    ( 3 ) T h e i n p u t - o u t p u t a r g u m e n t s o f a p r o c e d u r e ar e n o tf i x e d b u t d e p e n d u p o n t h e p r o c e d u r e c a l l . A p r o -c e d u r e w h i c h tests tha t a r e la t ionsh ip ho lds am onggiven ind iv idua ls can a l so be used to f ind i n d i v i d -ua ls for which the r e la t ionsh ip ho lds .

    T h e R e l a t io n s h i p B e t w e e n L o g i c a n d C o n t r ol

    In the preced ing sec t ions we cons ide red a l te rna t ivetop-down and bot tom -up cont ro l s t r a teg ie s for a f ixedpred ica te log ic r epre senta t ion of a problem -d om ain . Di f -ferent control s tra tegies for the same logical representa-t ion genera te d i f fe ren t behavior s . However , in form at iona b o u t a p r o b l e m - d o m a i n c a n b e r e p r es e n t ed i n l og i c i nd i f fe ren t ways . Al te rna t ive r epre senta t ions can have am ore s ig n i f i can t e f fec t on th e e f f i c iency of an a lg or i thmthan a l te rna tive cont ro l s t r a teg ie s for the sam e repre sen-ta t ion .C ons id e r the prob lem o f sor t ing a l is t . In one repre -senta t ion , we have the de f in i t ionsorting x givesy ~---y s a permu tation of x, y is ordered.( H e r e w e h a v e u s e d d i s t r i b u t ed i n f i x n o ta t i o n f o r p r ed i -ca te sym bols , wr i t ing PlxlPzx2 .. . PnX,P,+I i n s t e a d o fP ( x 1 . . . . . X n ) w h e r e t h e Pi (pos s ib ly em pty) a re parts o fP. ) As descr ibed in [24], dif ferent control s tra tegies ap-p l ied to the de f in i t ion genera te d i f fe ren t behavior s . N oneof the se behavior s , however , i s e f f ic ien t enou gh to qu a l i fyas a r ea sonable sor t ing a lgor i thm . B y cont ra s t , even thes im ples t top-dow n, sequ ent ia l cont ro l behaves e f f i c ien t lywi th the log ic of qu icks or t [17] :Communications July 1979of Volume 22the ACM Number 7

  • 7/30/2019 Algorithm = Logic + Control

    6/13

    s o r t i n g x g i v e s y ~ -- x i s e m p t y , y i s e m p t ys o r t i n g x g i v e s y ~ -- f i r s t e l e m e n t o f x i s x~ , r e s t o f x i s x e ,

    p a r t i t i o n i n g x ~ b y x ~ g i v e s u a n d v ,s o r t i n g u g i v e s u ' ,s o r t i n g v g i v e s v ' ,a p p e n d i n g w to u ' g i v e s y ,f i r s t e l e m e n t o f w i s x l ,res t of w i s v ' .

    Like the predicates "permutation" and "ordered" before,the predicates "empty," "first," "rest," "partitioning,"and "appending" can be defined independently from thedefinition of "sorting." (Partitioning x2 by Xl is intendedto give the list u of the elements of x2 which are smallerthan or equal to xl and the list v of the elements of x2which are greater than xl.)Our thesis is that, in the systematic development ofwell-structured programs by successive refinement, thelogic component needs to be specified before the controlcomponent. The logic component defines the problem-domain-specific part of an algorithm. It not only deter-mines the meaning of the algorithm but also influencesthe way the algorithm behaves. The control componentspecifies the problem-solving strategy. It affects the be-havior of the algorithm without affecting its meaning.Thus the efficiency of an algorithm can be improved bytwo very different approaches, either by improving thelogic component or by leaving the logic componentunchanged and improving the control over its use.Bibel [3, 4], Clark, Darlington, Sickel [7, 8, 9], andHogger [21] have developed strategies for improvingalgorithms by ignoring the control component and usingdeduction to derive a new logic component. Their meth-ods are similar to the ones used for transforming formalgrammars and programs expressed as recursion equa-tions [13].

    In a logic programming system, specification of thecontrol component is subordinate to specification of thelogic component. The control component can either beexpressed by the programmer in a separate control-spec-ifying language, or it can be determined by the systemitself. When logic, is used, as in the rela tional calculus,for example [11], to specify queries for a database, thecontrol component is determined entirely by the system.In general, the higher the level of the programminglanguage and the less advanced the level of the program-mer, the more the system needs to assume responsibilityfor efficiency and to exercise control over the use of theinformation which it is given.

    The provision of a separate control-specifying lan-guage is more likely to appeal to the more advancedprogrammer. Greater efficiency can often be achievedwhen the programmer is able to communicate controlinformation to the computer. Such information mightbe, for example, that in the relation F ( x , y ) the value ofy is a function of the argument x. This could be used bya backtracking interpreter to avoid looking for anothersolution to the first goal in the goal statement -F ( A ,y ) , G( y )

    4 2 9

    when the second goal fails. Another example of suchinformation might be that one procedurep e - - Qis more likely to solve P than another procedureP e - R .This kind of information is common in fault diagnosiswhere, on the basis of past experience, it might be knownthat symptom P is more likely to have been caused by Qthan R.Notice, in both of these examples, that the controlinformation is problem-specific. However, if the controlinformation is correct and the interpreter is correctlyimplemented, then the control information should notaffect the meaning of the algorithm as determined by itslogic component.

    D a t a S t r u c t u r e s

    In a well-structured program it is desirable to separatedata structures from the procedures which interrogateand manipulate them. Such separation means that therepresentation of data structures can be altered withoutaltering the higher level procedures. Alteration of datastructures is a way of improving algori thms by replacingan inefficient data structure by a more effective one. Ina large, complex program, the demands for informationmade on the data structures are often fully determinedonly in the final stages of the program design. By sepa-rating data structures from procedures, the higher levelsof the program can be written before the data structureshave been finally decided.

    The data structures of a program are already includedin the logic component. Lists for example can be repre-sented by terms, whereni l n a m e s f o r t h e e m p t y l i s t a n dc o n s ( x , y ) n a m e s t h e l i s t w i t h f i r s t e l e m e n t x a n d r e s t w h i c h i s

    a n o t h e r l i s t y .Thus the termc o n s (2 , c o n s (1 , c o n s (3 , n i l ) ) )names the three-element list consisting of the individuals2, 1, 3 in that order.The data-structure-free definition of quicksort in thepreceding section interacts with the data structure forlists via the defini tionsni l i s e m p t y ~ - -f i r s t e l e m e n t o f c o n s ( x , y ) is xres t of c o n s ( x , y ) is yIf the predicates "empty, " "first," and "rest" are elimi-nated from the definition of quicksort by a preliminarybottom-up deduction, then the original data-structure-free definition can be replaced by a definition whichmixes the data structures with the proceduresC o m m u n i c a t i o n s J u l y 1 97 9o f V o l u m e 2 2t he A C M N u m b e r 7

  • 7/30/2019 Algorithm = Logic + Control

    7/13

    s o r t i n g n i l g i v e s n ils o r t i n g c o n s ( x~ , x 2 ) g i v e s y ~ p a r t i t i o n i n g x 2 b y x ~ g i v e s u a n d v ,

    s o r t i n g u g i v e s u ' ,s o r t i n g v g i v e s v ',a p p e n d i n g t o u ' th e l i st c o n s (x~ , v ' ) g ivesy .

    C l a r k a n d T a r n l u n d [ 6 ] s h o w h o w t o o b t a i n a m o r ee f f ic ien t ve r s ion of qu icksor t f rom the sam e abs t rac tde f in i t ion wi th a d i f fe ren t da ta s t ruc ture for l is t s.

    C om p ar ing th e or ig ina l da ta - s t ruc ture - f ree de f in i t ionw i t h t h e n e w d a t a - s t r u c t u r e - d e p e n d e n t o n e , w e n o t i c ea n o t h e r a d v a n t a g e o f d a t a - s t r u c t u r e - i n d e p e n d e n c e : t h efac t tha t , wi th we l l - chosen nam es for the in te r fac ingprocedures , da ta - s t ruc ture - independent program s a rev i r tua l ly se l f -docum ent ing . F or the convent iona l pro-g r a m w h i c h m i x e s p r o c e d u r e s a n d d a t a s t r u c t u r e s , t h ep r o g r a m m e r h a s t o p r o v i d e d o c u m e n t a t i o n , e x t e rn a l tothe program , which expla ins the da ta s t ruc ture s . F or thew e l l -s t ru c t u r e d , d a t a - i n d e p e n d e n t p r o g r a m , s u c h d o c u -m e n t a t i o n i s p r o v i d e d b y t h e i n t e r fa c i n g p r o c e d u r es a n dis pa r t o f the p rogram .Desp i te the a rgum ents for sepa ra t ing da ta s t ruc ture sa n d p r o c e d u re s , p r o g r a m m e r s m i x t h e m f o r t h e s a k e o frun- t im e e f f ic iency . One way of r econc i l ing e f f i c iencywi th good program s t ruc ture i s to use the m acroexpan-s ion fac i l i t i e s prov ided in som e program m ing languages .M a c r o e x p a n s i o n f l at t en s t h e h i e r a r c h y o f p r o c e d u r e c a l lsb e f o re r u n - t i m e a n d i s th e c o m p u t a t i o n a l a n a l o g o f t h eb o t t o m - u p a n d m i d d l e - o u t r e a s o n i n g p r o v i d e d b y s o m etheorem -p roving sys tem s . M acro-exp ans ion i s a lso a f ea -t u r e o f t h e p r o g r a m i m p r o v i n g t r a n s f or m a t i o n s d e v e l-o p e d b y B u r s t al l a n d D a r l in g t o n .N o t i c e h o w o u r t e r m i n o l o g y c o n f l i c t s w i t h W i r t h ' s[39]: p rog ram = a lgor i thm + da ta s t ruc ture . In ourte rm inology the de f in i t ion of da ta s t ruc ture s be longs tothe log ic com pon ent of a lgor i thm s . Even m ore confus -ingly , we would l ike to ca l l the log ic com ponent ofa lgor i thm s " log ic program s . " This i s because , g iven af ixed Horn c lause in te rprete r , the prog ram m e r need onlyspec i fy the log ic com ponen t . Th e in te rpre te r can exe rc i sei ts o w n c o n t r o l ov e r t h e w a y i n w h i c h t h e i n f o r m a t i o n i nthe log ic com p onent i s used . Of cour se , i f the prog ram -m er knows how the in te rpre te r behaves , then he canexpres s h im se l f in a m ann er w hich i s de s igned to e l i c i tthe behavior he des i r e s .

    T o p - D o w n E x e c u t i o n o f P r o c e d u r e C a l lsIn the s im ples t top-down execut ion s t r a tegy , proce -

    dure ca l l s a re executed one a t a t im e in the sequence inw h i c h t h e y a r e w r i tt e n. T y p i c a l l y a n a l g o r i t h m c a n b eim proved by execut ing the sam e procedure ca l l s e i the ra s corout ines or a s com m unica t ing pa ra l le l p roces se s .T h e n e w a l g o r i t h mA 2 = L + C 24 3 0

    i s ob ta ined f rom the or ig ina l a lgor i thmA ~ = L + C1by rep lac ing one cont ro l s t r a tegy by anothe r leav ing thel o g ic o f t h e a l g o r i t h m u n c h a n g e d .

    F or exam ple , execut ing procedure ca l l s in sequence ,t h e p r o c e d u r es o r t i n g x g i v e s y ~ -- y i s a p e r m u t a t i o n o f x , y i s o r d e r e d

    f i rs t gene ra te s pe rm uta t ions of x and then te st s wh e the rthey a re orde red . Execut ing procedure ca l l s a s corou-t ines , the procedu re genera te s pe rm uta t ions , one e lem enta t a t im e . Whenever a new e lem ent i s gene ra ted , thegenera t ion of o the r e lem ents i s suspended whi le i t i sde te rm ined whe the r the new e lem ent pre se rves the or -de redness of the ex i s t ing pa r t ia l pe rm uta t ion . Th i s ex-am ple i s d i s cus sed in m ore de ta i l e l sewhere [24] .

    S im i la r ly the procedure ca l l s in the body of thequicksor t de f in i t ion can be executed e i the r in sequenceor a s corout ines or pa ra l le l p roces se s . Executed in pa r -a l le l , pa r t i t ion ing the r e s t o f x can be in i t ia ted a s soon a sthe f i rs t e lem ents of the r e st a re genera ted . S or t ing theoutpu t , u and v , o f the pa r t i t ion ing proced ure can beg inand proceed in pa ra l le l a s soon a s the f i r s t e lem ents of uand v a re genera ted . A pp endin g can b eg in a s soon a s thef i r s t e lem ents of u ' , the sor ted ve r s ion of u , a re known.

    P hi l ipp e Rous se l [33] ha s inves t iga ted the problem ofshow ing tha t two t r ee s have the sam e l i st s o f leaves :x a n d y h a v e t h e s a m e l e a v e s ~ t h e l e a v e s o f x a r e z ,

    t h e l e a v e s o f y a r e z ' ,z a n d z ' a r e t h e s a m e

    x a n d x a r e t h e s a m e ~ - -E x e c u t i n g p r o c e d u r e c a l ls i n t h e s e q u e n c e i n w h i c h t h e yare writ ten, th e proc edu re f irs t construc ts the l i .s t z ofleaves of x , then cons t ruc t s the l i s t z ' o f leaves of y , a ndf ina l ly te s ts tha t z and z ' a re the sam e . R ousse l ha sa rgued tha t a m ore sophis t i ca ted a lgor i thm i s ob ta ined ,w i t h o u t c h a n g i n g t h e l o g i c o f t h e a l g o r i th m , b y e x e c u t i n gthe sam e proced ure ca l l s a s com m un ica t in g pa ra l le l p ro-cesse s. W hen one proces s f inds a lea f , i t suspends ac t iv i tyand wa i t s un t i l the o the r proces s f inds a lea f . A th i rdproces s then te s t s whe th e r the two leaves are ident ica l . I fthe leaves are identical , then the f irs t two processesre sum e . I f the leaves a re d i f fe ren t , then the en t i r e pro-cedu~e fa i ls and te rm ina te s .The pa ra l le l a lgor i thm i s s ign i f i can t ly m ore e f f i c ien tt h a n t h e s i m p l e s e q u e n t ia l o n e w h e n t h e t w o t re e s h a v edifferent l is ts of leaves . In this case the sequentia l a lgo-r i thm recognizes f a i lure only a f te r bo th l i s t s have beencom ple te ly genera ted . The pa ra l le l a lgor i thm recognizesfa i lure as soon as the two l is ts begin to dif fer .T h e s e q u e n t i a l a lg o r i t h m , w h e t h e r i t e v e n t u a l l y s u c -ceeds or f a i l s , cons t ruc t s the in te rm edia te l i s t s z and z 'w h i c h a re n o l o n g e r n e e d e d w h e n t h e p r o c e d u r e t e r m i-na te s . In cont ra s t , the pa ra l le l a lgor i thm can be im ple -m ented in such a way tha t i t com pares the two l i s t s zand z ' , one e lem ent a t a t im e , wi thout cons t ruc t ing andC o m m u n i c a t i o n s J u l y 1 97 9o f V o l u m e 2 2t he A C M N u m b e r 7

  • 7/30/2019 Algorithm = Logic + Control

    8/13

    sav ing the in i t ia l l i st s o f those e lem ents a l r eady com paredand found to be ident ica l .I n a h i g h l ev e l p r o g r a m m i n g l a n g u a g e li k e S I M U L A

    it is pos s ib le to wr i te bo th the usu a l sequent ia l a lgor i thm sa n d a l s o c o r o u t i n i n g o n e s i n w h i c h t h e p r o g r a m m e rcontro ls when corout ines a re suspended and re sum ed.B ut , a s in o the r convent iona l program m ing languages ,log ic and cont ro l a re inext r i cably in te r twined in theprogram tex t . I t i s no t pos s ib le to change the cont ro ls t r a tegy of an a lgor i thm wi thout r ewr i t ing the programentire ly.

    The a rgum ents for sepa ra t ing log ic and cont ro l a rel ike the ones for sepa ra t ing procedures and da ta s t ruc -ture s . When procedures a re sepa ra ted f rom da ta s t ruc -ture s , i t i s pos s ib le to d i s t ingu i sh ( in the procedures )wh a t func t ions the da ta s t ruc ture s fu l f i l l f rom the m an nerin which the da ta s t ruc ture s fu l f il l them . W hen log ic i ssepa ra ted f rom cont ro l , i t i s pos s ib le to d i s t ingu i sh ( int h e l og i c ) w h a t t h e p r o g r a m d o e s f r om h o w t h e p r o g r a mdoes i t ( in the cont rol ) . In bo th ca ses i t i s m ore ob viouswha t the program does , and the re fore i t i s ea s ie r tode te rm ine whe the r i t cor rec t ly does wha t i t i s in tendedto do.Th e work o f C la rk and Tarn lund [6] (on the correc t-n es s o f s or ti n g a l g o ri t h m s ) a n d t h e u n p u b l i s h e d w o r k o fW ar ren and Ko walsk i (on the cor rec tnes s of p lan- for -m at ion a lgor i thm s) suppor t s the the s i s tha t cor rec tnes sproof s a re s im pl i f ied when they dea l on ly wi th the log icc o m p o n e n t a n d i g n o r e th e c o n t r o l c o m p o n e n t o f al g o -r i thm s . S im i la r ly , ignor ing cont ro l s im pl i f ies the d e r iva -t ion o f program s from s pecif ic at ions [3, 4, 7, 8, 9, 21].

    T o p - D o w n v s . B o t t o m - U p E x e c u t i o nR e c u r s i v e d e f i n i t i o n s a r e c o m m o n i n m a t h e m a t i c sw h e r e t h e y a r e m o r e l i k e l y t o b e u n d e r s t o o d b o t t o m - u p

    ra the r than top-down. C ons ide r , for exam ple , the de f i -n i t ion o f f ac toria lT h e f a c t o r i a l o f 0 i s 1 ~ --T h e f a c t o r i a l o f x i s u < - - y p l u s 1 i s x ,

    t h e f a c t o r i a l o f y i s v,x t i m e s v i s u .

    T h e m a t h e m a t i c i a n i s li k e l y t o u n d e r s t a n d s u c h a d e f i-n i t ion bo t tom -up , genera t ing the sequence o f a s se r tionsT h e f a c t o r i a l o f 0 i s 1 < ---T h e f a c t o r i a l o f 1 i s 1 < --T h e f a c t o r i a l o f 2 i s 2 < --T h e f a c t o r i a l o f 3 i s 6 < --e t c .C o n v e n t i o n a l p r o g r a m m i n g l a n g u a g e i m p l e m e n t a t i o n sunder s tand recur s ions top-down. P rogram m ers , a ccord-ingly , tend to ident i fy r ecur s ive de f in i t ions wi th top-d o w n e x e c u t i o n.

    An in te re s t ing except ion to the ru le tha t r ecur s ivede f in i t ions a re m ore e f f i c ien t ly executed top -dow n th anb o t t o m - u p i s th e d e f i n i ti o n o f a F i b o n a c c i n u m b e r , w h i c h43 1

    i s bo th m ore in te l l ig ib le and e f f ic ien t when in te rpre tedb o t t o m - u p :t h e 0 - t h F i b o n a c c i n u m b e r i s 1 ~--t h e l - t h F i b o n a c c i n u m b e r i s 1t h e u + 2 - t h F i b o n a c c i n u m b e r i s x

    t h e u + l - t h F i b o n a c c i n u m b e r i s y ,t h e u - t h F i b o n a c c i n u m b e r i s z ,

    y p l u s z i s x .

    (H ere the terms u + 2 and u + 1 are express ion s to beeva lua ted ra the r th an te rm s repre sent ing da ta s t ruc ture s .This no ta t ion i s an a b b rev ia t io n for the one which hasexpl ic i t p rocedure ca l l s in the body to eva lua te u + 2and u + 1. )

    I n t e r p re t e d t op - d o w n , f i n d i n g t h e u + l - t h F i b o n a c c in u m b e r r e i nt r o d u c e s t h e s u b p r o b l e m o f f i n d i n g th e u - t hF i b o n a c c i n u m b e r . T h e t o p - d o w n c o m p u t a t i o n i s a t re ewh ose nodes a re procedure ca l ls , the num ber o f wh ich i san exponent ia l func t ion of u . In te rpre t ing the sam edef in i t ion bo t tom -u p g enera tes the sequence o f a s se r tionst h e 0 - t h F i b o n a c c i n u m b e r i s 1 ~ --t h e l - t h F i b o n a c c i n u m b e r i s 1t h e 2 - t h F i b o n a c c i n u m b e r i s 2 ~ - -t h e 3 - t h F i b o n a c c i n u m b e r i s 3 ~ --e t c .T h e n u m b e r o f c o m p u t a t i o n s t ep s i s a l i ne a r f u n c t i o n o fl/ .

    In th i s exam ple , bo t tom -up execut ion i s a l so le s ss p a c e - c o n s u m i n g t h a n t o p - d o w n e x e c u t i o n . T o p - d o w nexecut ion use s space wh ich i s p ropor t iona l to u , whereasbot tom -up execut ion needs to s tore only two a s se r t ionsand c an use a sm a l l cons tan t am ou nt of s torage. Th a tonly two a s se r t ions need to be s tored dur ing bo t tom -upexecut ion i s a consequence of the de le t ion ru le s for thec o n n e c t i o n g r a p h p r o o f p r o c e d u r e [ 2 5 ] . A s B i b el o b -se rves , the grea te r e f f i c iency of bo t tom -up execut iondisapp ea r s i f s im i la r procedu re ca l l s are executed top-dow n only once . Th i s s t r a tegy i s, in f ac t , an ap pl ica t ionof War ren ' s gene ra l i za t ion of the Ear ley pa r s ing a lgo-r i thm .

    Str a te g ie s for I nve s t i ga t ing A l te r nat ive Pr oce dur e sW h e n m o r e t h a n o n e p r o c e d u r e h a s a c o n c l u s i o n

    which m a tches a g iven procedure ca l l , the log ic com po-nent does not de te rm ine the m anner in which the a l te r -na t ive procedures a re inves t iga ted . S equent ia l explora -t ion of a l ternatives gives r ise to i tera t ive a lgor i thms.Al though in theory a l l i te ra t ions can be rep laced bytop-down execut ion of r ecur s ive de f in i t ions , in prac t i cesom e i te ra t ions m ight be t te r be thought of a s bo t tom -upexecut ion of r ecur s ive de f in i t ions (a s in the d e f in i t ion offac tor ia l ) . Othe r i te ra t ions can be t te r be r ega rded a scont ro l l ing a sequent ia l s ea rch am on g a l te rna tive s .Assum e , for exam ple , tha t we a re g iven da ta aboutind iv idua ls in the pa renthood re la t ionsh ip :C o m m u n i c a t i o n s J u l y 1 97 9o f V o l u m e 2 2t h e A C M N u m b e r 7

  • 7/30/2019 Algorithm = Logic + Control

    9/13

    P a r e n t ( Z e u s , A r e s )P a r e n t ( H e r a , A r e s ) ~ -P a r e n t ( A r e s , H a r m o n i a ) ~ - -P a r e n t ( S e m e l e , D i o n i s i u s ) ~ -P a r e n t ( Z e u s , D i o n i s i u s )etc.Suppose that the problem is to find a grandchi ld of Zeus, -- - G r a n d p a r e n t ( Z e u s , u )using the definition of grandparent. In a conventionalprogramming language, the parenthood relationshipmight be stored in a two-dimensional array. A generalprocedure for finding grandchildren (given grandpar-ents) might involve two iterative loops, one nested insidethe other, with a jump out when a solution has beenfound. Similar behavior is obtained by interpreting thegrandparent procedure top-down, executing procedurecalls one at a time, in the sequence in which they arewritten, trying alternative procedures (assertions in thiscase) one at a time in the order in which they are written.The logical analysis of the conventional iterative algo-rithm does not concern recursion but involves sequentialsearch through a space of alternatives. The sequentialsearch strategy is identical to the backtracking strategyfor executing nondeterministi c programs [ 18].Representation of data by means of clauses, as in thefamily relationships example, rather than by means ofterms, is similar to the relational model of databases[10]. In both cases data is regarded as relationshipsamong individuals. When data is represented by conven-tional data structures (terms), the programmer needs tospecify in the logic component of programs and queriesboth how data is stored and how it is retrieved. Whendata is represented relationally (by clauses), the program-mer needs only to specify data in the logic component;the control component manages both storage and re-trieval.The desirability of separating logic and control isnow generally accepted in the field of databases. Animpor tant advantage is that storage and retrieval schemescan be changed and improved in the control componentwithout affecting the user's view of the data as definedby the logic component.The suitability of a search strategy for retrieving datadepends upon the structure in which the data is stored.Iteration, regarded as sequential search, is suitable fordata stored sequentially in arrays or linked lists. Othersearch strategies are more appropriate for other datastructures, such as hash tables, binary trees, or semanticnetworks. McSkimin and Minker [29], for example,store clauses in a manner which facilitates both parallelsearch and finding all answers to a database query.Deliyanni and Kowalski [ 15], on the other hand, proposea path-finding strategy for retrieving data stored in se-mantic networks.Representation of data by means o f terms is a com-mon feature of Horn clause programs written inPROLO G [12, 33, 38]. Tiirnlund [36], in particular , hasinvestigated the use of terms as data structures in Horn43 2

    clause programs. Several PROLOG programs employ arelational representation of data. Notable among theseare Warren's [37] for plan-formation and those for druganalysis written in the Ministry of Heavy Industry inBudapest [14].Two Analyses of P ath-Finding Algorithms

    The same algorithm A can often be analyzed indifferen t ways:A = L I + C I = L 2 + 6"2.Some of the behavior determined by the control com-ponent C1 in one analysis might be determined by thelogic component L2 in another analysis. This has signif-icance for understanding the relationship between pro-gramming style and execution facilities. In the short termsophisticated behavior can be obtained by employingsimple execution strategies and by writing complicatedprograms. In the longer term the same behavior may beobtained from simpler programs by using more sophis-ticated execution strategies.The path-finding problem illustrates a situation inwhich the same algorithm can be analyzed in differentways. Consider the problem of finding a path from A toZ in the following directed graph.

    D

    r VIn one analysis, we employ a predicate G o ( x ) whichstates that it is possible to go to x. The problem of goingfrom A to Z is then represented by two clauses. Oneasserts that it is possible to go to A. The other denies thatit is possible to go to Z. The arc directed from A to B isrepresented by a clause which states that it is possible togo to B if it is possible to go to A:

    Go ( .4) , - - ~ Go (Z )Go (B) ~-- Go (A) Go (Z )

  • 7/30/2019 Algorithm = Logic + Control

    10/13

    ma t t e r o f t he se a rch s t ra t e gy use d t o i nve s t i ga t e al t e r-na t i ve s .

    I n t h e s e c o n d a n a l y s i s , w e e m p l o y a p r e d i c a t eG o * ( x , y ) wh i ch s t a te s t ha t i t i s poss i b l e t o go f rom x t oy . I n a d d i t i o n t o t h e a s s e rt i on s w h i c h d e s c r i b e t h e g r a p ha n d t h e g o a l s t a t e m e n t w h i c h d e s c r i b e s t h e p r o b l e m ,t he re i s a s i ng l e c l a use w hi ch de f i ne s t he l og i c o f t hep a t h - f i n d i n g a l g o ri t h m s :

  • 7/30/2019 Algorithm = Logic + Control

    11/13

    P roces s ing ac t iv i ty or ig ina tes wi th the da tab ase o f in it ia la s se rt ions . Th ey t r ansm i t ac t iv i ty to the pa renth ood de f -in i t ions , which , in turn , a c t iva te the grandparent de f in i -t ion . P roces s ing te rm ina te s when i t r eaches a l l the con-d i t ions in th e pas s ive in i t ia l goa l s ta tem ent .

    T h e g r a n d p a r e n t d e f i n i ti o n c a n b e u s e d i n a c o m b i -n a t i o n o f t o p - d o w n a n d b o t t o m - u p m e t h o d s . U s i n g n u m -ber s to ind ica te sequenc ing , we can repre sent d i f f e ren tc o m b i n a t i o n s o f t o p - d o w n a n d b o t t o m - u p e x e c u t i o n . F o rs im pl ic i ty we only show the cont ro l no ta t ion a s soc ia tedw i t h t h e g r a n d p a r e n t d e f i n i t i o n . T h e c o m b i n a t i o n o flog ic and cont ro l ind ica ted by

    3G r a n d p a r e n t ( x , y ) ~ P a r e n t ( x , z ), P a r e n t ( z , y )

    1 2repre sents the a lgor i thm which( l ) wa i t s un t i l x i s a s se r ted to be pa rent of z , then(2) f inds a ch i ld y of z , and f ina l ly(3) a s ser t s tha t x is g rand parent ofy .T h e c o m b i n a t i o n i n d i c a t e d b y

    2G r a n d p a r e n t ( x , y ) ~ -- P a r e n t ( x , z ), P a r e n t ( z , y )

    1 3

    repre sents the a lgor i thm which(1) waits unti l x is asser ted to be parent of z , the n(2) wa i t s un t i l i t i s g iven the prob lem of show ing tha t

    x i s g r a n d p a r e n t o f y ,(3 ) wh ich i t then a t tem pts to so lve by show ing tha t z i sp a r e nt o f y .T h e a l g o r i t h m r ep r e s e n te d b y

    1ILG r a n d p a r e n t ( x , y ) ~ P a r e n t ( x , z ), P a r e n t ( z , y )

    2 3(1 ) r e sponds to the problem of show ing tha t x i s g rand-

    p a r e n t o f y ,(2) by w a i t ing un t i l x i s a s se r ted to be pa rent of z , and

    t h e n(3) a t tem pt ing to show tha t z i s pa rent ofy .

    Us ing the a r row nota t ion , we can be m ore prec i set h a n b e f o re a b o u t t h e b o t t o m - u p e x e c u t i o n o f t h e r e c u r-s i v e d e f i n i t i o n o f F i b o n a c c i n u m b e r . T h e b o t t o m - u pexecut ion re fe r red to prev ious ly i s , in f ac t , a m ix ture o fb o t t o m - u p a n d t o p - d o w n e x e c u t i o n :

    4the u + 2 Fib i s x ~-- the u + 1 Fib i s y , the u F ib i s z , y p lus z i s x .

    2 1 343 4

    Arrow nota t ion can a l so be used to g ive a proced ura li n t e rp r e t a ti o n o f n o n - H o r n c l au s es . T h e d e f i n i t i o n o fsubset , for ex ample , "x is a subset of y if , for a l l z , i f zbe longs to x , th en z b e longs to y , " g ives ri se to ap r o c e d u r e w h i c h s h o w s t h a t x i s a su b s e t o f y b y s h o w i n gt h a t e v e r y m e m b e r o f x i s a m e m b e r o f y . I t d o es t h i s b yas se r t ing tha t som e ind iv idua l be longs to x and bya t t e m p t i n g t o s h o w t h a t t h e s a m e i n d i v i d u a l b e l o ng s t oy . T h e n a m e o f th e i n d i v i d u a l m u s t b e d i f f er e n t f r o m t h en a m e o f a n y i n d i v i d u a l m e n t i o n e d e l s e w h e r e , a n d i tm u s t d e p e n d u p o n x a n d y ( b e i n g d i f f e r e n t f o r d i f f e re n tx a nd y) . In c lausa l no ta t ion w i th a r rows to ind ica tecont ro l , the d e f in i t ion of subse t becom es

    1 2

    x i s a s u b s e t o f y , arb ( x , y ) b e l o n g s t o x ~ -x i s a s u b s e t o f y ~ arb (x , y) b e l o n g s t o y

    n1 2Giv en the goa l of showing tha t x i s a subse t o f y , the f i r s tc lause a s se r ts tha t the ind iv idu a l nam ed arb ( x ,y ) be longsto x and the second c lause genera te s the goa l of show ingt h a t arb (x, y) be longs to y .T h e g r a n d p a r e n t d e f i n i t i on i ll u s t ra t es t h e i n a d e q u a c yof the a r row nota t ion for expre s s ing ce r ta in k inds ofcont ro l in form at ion . S uppose tha t the grandparent de f i -n i t ion i s to be used en t i r e ly top-down.G r a n d p a r e n t ( x , y ) ~ P a r e n t ( x , z) , P a r e n t ( z , y ) .

    Th e e f fec t ive sequenc ing of procedu re ca l l s in the bod yo f th e p r o c e d u r e d e p e n d s u p o n t h e p a r a m e t e r s o f th eac t iva t ing procedure ca l l :(1 ) I f the problem i s to f ind a grand chi ld y of a g iven

    x, then i t is more effect ive ( i ) f i rs t to f ind a child zof x ; ( ii ) and then to f ind a ch i ld y of z .(2 ) I f the problem i s to f ind a grand parent x of a g iven

    y, th en i t is better ( i ) f i rs t to f ind a p arent z o f y; ( i i )and then to f ind a pa rent x of z .

    S u c h s e q u e n c i n g o f p ro c e d u r e c a l ls d e p e n d i n g o n t h ep a t t e r n o f i n p u t a n d o u t p u t c a n n o t b e e x p r e ss e d i n t h ea r row nota t ion .

    In r e la t iona l da tabase que ry languages , input - sens i -t ive sequenc ing of procedu re ca l ls needs to be de te rm inedby the da ta r e t r ieva l sys tem ra the r than by the use r .C ons ide r , for exam ple , a da tabase which de f ines thefo l lowing re lat ions :S u p p l i e r ( x , y , z )P a r t ( x , y , z )S u p p l y ( x , y , z )

    s u p p l i e r n u m b e r x h a s n a m e y a n d s t a t u s z ,p a r t n u m b e r x h a s n a m e y a n d u n i t c o st z ,s u p p l i e r n u m b e r x s u p p l i e s p a r t n u m b e r y i nq u a n t i t y z .

    G i v e n t h e q u e r yW h a t i s t h e n a m e o f s u p p l i e r s o f p e n s ?

    A n s w e r ( y )A n s w e r ( y ) ~ -- S u p p l i e r ( x , y , z ) , S u p p l y ( x , u , v ) , P a r t ( u , p e n , w )C o m m u n i c a t i o n s J u l y 1 97 9o f V o l u m e 2 2t h e A C M N u m b e r 7

  • 7/30/2019 Algorithm = Logic + Control

    12/13

    the system needs to determine that, for the sake ofefficiency, the last procedure call should be executedfirst; whereas given the queryW h a t i s t h e na m e of p a r t s s u p p l ied b y J one s ? - - Answ er (y )Ans wer (y) ~ Sup pl ier (x , Jones , z) , Supply (x , u , v), Par t (u , y , w)the first procedure call should be executed before theothers.The arrow notation can be used to control the behav-ior of a connection graph theorem-prover [12]. The linksof a connection graph are turned into arrows by givingthem a direction. A link may be activated (giving rise toa resolvent) only if the link is connected to a clause allof whose links are outgoing. The links of the derivedresolvent inherit the direction of the links from whichthey descend in the parent clauses. Connection graphscontrolled in such a manner are similar to Petri nets[16].

    C o n c l u s i o nWe have argued that conventional algorithms canusefully be regarded as consisting of two components:

    (1) a logic component which specifies what is to bedone and(2) a control component which determines how it is tobe done.

    The efficiency of an algorithm can often be improvedby improving the efficiency of the control componentwithout changing the logic and therefore without chang-ing the meaning of the algorithm.The same algorithm can often be formulated in dif-ferent ways. One formulation might incorporate a clearstatement, in the logic component, of the knowledge tobe used in solving the problem and achieve efficiency byemploying sophisticated problem-solving strategies inthe control component. Another formulation might pro-duce the same behavior by complicating the logic com-ponent and employing a simple problem-solving strat-egy.Although the trend in databases is towards the sep-aration of logic and control, programming languagestoday do not distinguish between them. The programmerspecifies both logic and control in a single languagewhile the execution mechanism exercises only the mostrudimentary problem-solving capabilities. Computerprograms will be more often correct, more easily im-proved, and more readily adapted to new problems whenprogramming languages separate logic and control, andwhen execution mechanisms provide more powerfulproblem-solving facilities of the kind provided by intel-ligent theorem-proving systems.

    Acknowledgments. The author has benefited fromvaluable discussions with K. Clark, A. Colmerauer,M. van Emden, P. Hayes, P. Roussel, S. T~irnlund, andD. Warren. Special thanks are due to W. Bibel, K. Clark,4 3 5

    M. van Emden, P. Hayes, and D. Warren for thehelpful comments on earlier drafts of this paper. Thiresearch was supported by a grant from the SciencResearch Council. The final draft of this paper wacompleted during a visiting professorship held in thSchool of Computer and Information Science at thUniversity of Syracuse.R e ce iv e d D e ce m b e r 1 976 ; r e v i se d F e b r u a r y 1 978

    R e f e r e n c e s1. Bibe l , W. , and Schre iber , J . Proof procedu res in a Gentzen -l ikesys tem of f irs t-order logic . Proc. Int . Comptng. Symp. , North-Hollan d Pub. Co. , Amsterdam , 1975 , pp . 205-212.2. Bibe l , W. Prog rammieren in der Sprache der Pr~idika tenlogik .E ing e r e ich t al s H a b ib i t a t ions a r b e i t . F a ch b e r e ich M a th e m a t ik , Te ch nMii nchen, Jan. 1975. Shorter v ers ions publ is hed as : Pr~idika tivesP r og r a m m ie r en . Le c tu r e N ote s in C om p u te r S c ie nce , 33 , G I - 2 .F a ch ta g u n g f ib e r A u tom a te nth e or ie u nd f or m a le S p r a ch e n , S p r ing eVerlag, Berlin, Heide lberg, New Y ork, 1975, pp . 274-283. A nd as :Predica t ive Programming. S6minaires IRIA, th6or ie des a lgor i thms,des languages e t de la programmation 1975-1976, IRIA,Roquencourt , France , 1977.3 . Bibe l , W. S yntheses of s tra tegic def ini t ions and the ir control .Ber icht Nr . 7610, Ab t . Ma them. , Te ch n . M i inch e n , 1 976 .4 . B ib e l, W. A u n i f or m a p p r oa ch to p r og r a m m ing . B e ri ch t N r .7633, Abt l . Mathem. , Techn. MiJnchen, 1976.5. Bledsoe , W.W ., and Bruell, P . A man-mac hin e theorem-p rovin gsys tem. Artif. Intell. 5 (Spr ing 1974) , 51-72.6 . Clark, K .L. , and T~ irnlund, S .A. A f irs t order theory of da ta andprograms. Information Processing 77, N o r t h - H o l l a n d P u b . C o .,Ams terdam, 1977, pp . 939-944.7. Clark, K., and Sickel, S. Pred icate logic: A calcu lus for theformal der iva t io n of programs. Proc. Int . Jo int Conf . A rt if. Inte l l .,1977.8. Clark, K . Th e synthes is and ver if ica t ion of logic programs. Res .Rep. , Dept . Comptng. and Control , Imper ia l College , London, 19779. Clark, K . , and Darl ington , J . Algo r i thm analys is throu ghsynthes is . Res . Rep. , Dept . Comptng. and Control , Imper ia l CollegeLondon, Oct . 1977.I0. Codd, E.F . A re la t ional model for la rge shared da tabases .C o mm . A C M 1 3, 6 (Ju ne 1970) , 377-387.1 I . Codd, E.F . Rela t io nal comple teness of da ta base sublang uages .I n Data Base Systems, R. Rus t in, Ed. , Prent ice-Hall , EnglewoodCliffs, N.J., 1972.12. Colmerauer , A . , Kanoui , H . , Pasero, R. , and Rousse l , P . Uns y s tem e d e com m u nica t ion h om m e - m a ch ine e n f r a ncai s . Rapportpreliminaire, Groupe de Res. en Intell. Artif., U. d 'Aix-Marse i l le ,Luminy, 1972.13. Darl ington, J . , and Burs ta l l , R.M. A sys tem which automatica l lyimprov es programs. Proc. of Th ird Int . Joint Conf . Art if . Inte l l . ,S .R.I . , Men lo Park, Cal if . , 1 973, pp . 437-542.14. Darvas , F . , Futo, I . , and S zeredi , P . Logic based program forp r e d ic t ing d r u g in te r a c tions . To a p p e a r in Int. J. BiomedicalComputing.15. D el iyanni , A . , and K owalski , R.A. Logic and semantic ne tworksC o mm . A C M 2 2, 3 (M arch 1979) , 184-192.16. Earley, J . A n eff ic ient context-free pars ing a lgor i thm. Comm.A C M 13, 2 (Feb. 1970), 94-102.17. van Emden, M.H. Programming in resolut ion logic . To appear iMa chine Representations o f Knowledge p u b l i s h e d a s MachineIntelligence 8, E.W. Elcock and D. Michie , Eds . , El l is Horwood andJ oh n Wy l ie .18. F loyd, R.W . Non -determini s t ic a lgor i thms . J . A C M 1 4, 4 (Oct.1967), 636-644.1 9 . H a y e s , P .J . C om p u ta t ion a nd d e d u c t ion . P r oc . 2nd M F C SSymp. , Czec hos lovak A cad. of Sciences , 1973, pp . 105-118.20. H ewit t , C. P lanner : A languag e for proving theorem s in robots .Proc. of Int . Joint Conf . Art if . Inte l l. , Washin gton, D.C. , 1969, pp .295-301.21. Hogger , C. Deduc t ive synthes is of logic programs. Res . Rep. ,Dept . Comptng. and Control , Imper ia l College , London, 1977.22. Kleene, S.C. Introduction to Metamathematics. V a n N os t r a nd ,New York, 1952.C om m u nic a t ions J u ly 1 979of V olu m e 22t h e A C M N u m b e r 7

  • 7/30/2019 Algorithm = Logic + Control

    13/13

    2 3 . K o w a l s k i , R . A . L o g i c f o r p r o b l e m - s o l v i n g . M e m o N o . 7 5 , D e p t .C o m p u t . L o g i c , U . o f E d i n b u r g h , 1 9 74 .2 4 . K o w a l s k i , R . A . P r e d i c a t e lo g i c a s p r o g r a m m i n g l a n g u a g e .I n f o r m a t i o n P r o c e s s i n g 7 4 , N o r t h - H o l l a n d P u b . C o. , A m s t e r d a m ,1 9 7 4 , p p . 5 6 9 - 5 7 4 .2 5 . K o w a l s k i , R . A . A p r o o f p r o c e d u r e u s i n g c o n n ec t i o n g r a p h s .J . A C M 2 2 , 4 ( O c t . 1 9 7 4 ) , 5 7 2 - 9 5 .2 6 . K o w a l s k i , R . A . , a n d K u e h n e r , D . L i n e a r r e s o l u t i o n w i t h s e l e c ti o nf u n c t i o n . A r t i f . I n t e l L 2 ( 1 9 7 1 ) , 2 2 7 - 2 6 0 .2 7 . L o v e l a n d , D . W . A s i m p l i f i e d f o r m a t f o r t h e m o d e l - e l i m i n a t i o nt h e o r e m - p r o v i n g p r o c e d u r e . J . A C M 1 6 , 3 ( J u l y 1 9 6 9 ), 3 4 9 - 3 6 3 .2 8 . M a c C a r t h y , J . A b a s i s f or a m a t h e m a t i c a l t h e o r y o fc o m p u t a t i o n . I n C o m p u t e r P r o g r a m m i n g a n d F o r m a l S y s t e m s, P .B r a t f o r t a n d D . H i r s c h b e r g , E d s . , N o r t h - H o l l a n d P u b . C o . ,A m s t e r d a m , 1 9 6 7 .2 9 . M c S k i m i n , J . R . , a n d M i n k e r , J . T h e u s e o f a s e m a n t i c n e t w o r k i na d e d u c t i v e q u e s t i o n - a n s w e r i n g s y s t e m . P r o c . I n t. J o i n t C o n f . A r t i f.l n t e l l . , 1 9 7 7 , p p . 5 0 - 5 8 .3 0 . P e t r i , C . A . G r u n d s a t z l i c h e s z u r B e s c h r e i b u n g d i s k r e t e r P r o z e s s e3 . C o l l o q . u b e r A u t o m a t h e n t h e o r i e , B i r k h a u s e r V e r l a g , B a s el ,S w i t z e r l a n d , 1 9 6 7 .3 1 . P r a tt , V . R . T h e c o m p e t e n c e / p e r f o r m a n c e d i c h o t o m y i np r o g r a m m i n g . P r oc . F o u r t h A C M S I G A C T / S I G P L A N S y m p . o n

    P r i n c i p l e s o f P r o g r a m m i n g L a n g u a g e s , S a n t a M o n i c a , C a l if . , J a n .1 9 7 7, p p 1 9 4 - 2 0 0 .3 2 . R o b i n s o n , J .A . A u t o m a t i c d e d u c t i o n w i t h h y p e r - r e s o l u t i o n . In t .J . C o m p u t . M a t h . 1 ( 1 9 6 5 ) , 2 2 7 - 3 4 .3 3 . R o u s s e l , P . M a n u a l d e r e f e r e nc e e t d ' U t i l i s a t i o n . G r o u p e d ' I n t e ll .A r t i f ., U E R , M a r s e i l l e - L u m i n y , F r a n c e , 1 9 75 .3 4 . S c h w a r z , J . U s i n g a n n o t a t i o n s t o m a k e r e c u r s i o n e q u a t i o n sb e h a v e . R e s . M e m o , D e p t . A r t if . I nt e ll . , U . o f E d i n b u r g h , 1 9 77 .3 5 . S i c k e l, S . A s e a r c h t e c h n i q u e f o r c l a u s e i n t e r c o n n e c t i v i t y g r a p h s .I E E E T r a n s. C o m p t r s . ( S p e c i a l I ss u e o n A u t o m a t i c T h e o r e mP r o v i n g ) , A u g . 1 9 76 .3 6 . T ~ i r n lu n d , S . A . A n i n t e r p r e t e r f o r t h e p r o g r a m m i n g l a n g u a g ep r e d i c a t e l o g i c . P r o c . I n t . J o i n t C o n f . A r t i f . I n t el l . , T i b l is i , 1 9 7 5 , p p .6 0 1 - 6 0 8 .3 7 . W a r r e n , D . A s y s t e m f o r g e n e r a t i n g p l an s . M e m o N o . 7 6 , D e p t .C o m p u t . L o g i c , U . o f E d i n b u r g h , 1 9 74 .3 8 . W a r r e n , D . , P e r ei r a , L . M . , a n d P e r e i r a , F . P R O L O G - - T h el a n g u a g e a n d i t s i m p l e m e n t a t i o n c o m p a r e d w i t h L I S P . P r o c . S y m p .o n A r t i f . I n te l l. a n d P r o g r a m m i n g L a n g u a g e s ; S I G P L A N N o t i c e s( A C M ) 1 2, 8 ; S I G A R T N e w s l e t te r s ( A C M ) 6 4 ( A u g . 1 9 7 7 ) , p p . 1 0 9 -1 1 53 9 . W i r t h , N . A l g o r i t h m s + D a t a S t r u c t u r e s = P r o g r a m s . P r e n t i c e -H a l l , E n g l e w o o d C l i f f s , N . J . , 1 9 7 6 .

    Pro fess i o na l Ac t i v i t ie s :C a l e n d a r o f E v e n t sA C M ' s c a l e n d a r p o l i c y i s t o l i s t o p e n c o m -p u t e r s c i e n c e m e e t i n g s t h a t a r e h e l d o n a n o t - f o r -p r o f i t b a s i s . N o t i n c l u d e d i n t h e c a l e n d a r a r e e d u -c a t i o n a l s e m i n a r s , i n s t i t u t e s , a n d c o u r s e s . S u b -m i t t a l s s h o u l d b e s u b s t a n t i a t e d w i t h n a m e o f t h es p o n s o r i n g o r g a n i z a t i o n , f ee s c h e d u l e , a n d c h a i r -

    m a n ' s n a m e a n d f u l l a d d r e s s .O n e t e l e p h o n e n u m b e r c o n t a c t f o r t h o s e i n-t e r e s t e d i n a t t e n d i n g a m e e t i n g w i l l b e g i v e n w h e na n u m b e r i s s p e c i f i ed f o r t h i s p u r p o s e .A l l r e q u e st s f o r A C M s p o n s o rs h i p o r c o o p -e r a t i o n s h o u l d b e a d d r e s s e d t o C h a i r m a n , C o n -f e r e n c e s a n d S y m p o s i a C o m m i t t e e , S e y m o u r J .W o l f s o n . 6 4 3 M a c K e n z i e H a l l , W a y n e S t a t e U n i -v e r s i t y , D e t r o i t , M I 4 8 2 0 2 , w i t h a c o p y t o L o u i sF l o r a , C o nf e r e n c e C o o rd i n a t o r , A C M H e a d -q u a r t e r s , 1 1 3 3 A v e n u e o f t h e A m e r i c a s , N e w Y o r k ,N Y 1 0 0 3 6; 2 1 2 26 5 - 6 3 0 0. F o r E u r o p e a n e v e n t s , ac o p y o f t h e r e q u e s t s h o u l d a l s o b e s e n t t o t h eE u r o p e a n R e p r e s e n t a t i v e . T e c h n i c a l M e e t i n g R e -q u e s t F o r m s f o r t h i s p u r p o s e c a n b e o b t a i n e df r o m A C M H e a d q u a r t e r s o r f r o m th e E u r o p e a nR e g i o n a l R e p r e s e n t a t i v e . L e a d t i m e s h o u l d i n c l u d e2 m o n t h s ( 3 m o n t h s i f f o r E u r o p e ) f o r p r o c e s s i n go f t h e r e q u e s t , p l u s t h e n e c e s s a r y m o n t h s ( m i n i -m u m 3 ) f o r a n y p u b l i c i t y t o a p p e a r i n C o m m u n i -ca t ions .

    T h i s s y m b o l i n d i c a t e s t h a t t h e C o n f e r e n c e sa n d S y m p o s i a C o m m i t t e e h a s g i v e n i t s a p p r o v a lf o r A C M s p o n s o r sh i p o r c o o p e r a t i o n.In t h i s i s s u e t he ca l end a r i s g i ven i n i t s en t i r e t y .N e w L i s t i n g s a r e s h o w n ~ r s t ; t h e y w i l l a p p e a rn e x t m o n t h a s P r e v i o u s L i st i n g s.N E W L I S T I N G S6 - 8 A u g u s t 1 9 7 9S e v e n t h C o n f e r e n c e o n E l e c tr o n i c C o m p u -t a t io n , W a s h i n g t o n U n i v e r s i t y , S t . L o u i s , M o .S p o n s o r : A S C E , W a s h i n g t o n U n i v e r s i t y . C o n t a c t :C . W a y n e M a r t i n , 2 1 2 B a n c r o f t H a l l , U n i v e r s i t yo f N e b r a s k a , L i n c o l n , N E 6 8 5 8 8 .

    7 -8 A u g u s t 1 9 79W o r k s h o p o n t h e U s e o f C o m p u t e r s i nT e a c h i n g S t a t i s t i c s , U n i v e r s i ty o f N e w H a m p -s h i r e , D u r h a m , N H . S p o n s o r : U n i v e r s i t y o f N e wH a m p s h i r e . C o n t a c t : O f f i c e o f A c a d e m i c C o m -p u t i n g , U n i v e r s i t y o f N e w H a m p s h i r e , 3 0 4 M c -C o n n e l l H a l l , D u r h a m , N H 0 3 8 2 4; 6 0 3 86 2 - 1 99 0 .12 -14 S ep tem b er 19 7 97 t h S I M U L A U s e r s ' C o n f e r en c e , H o t e l R e -g i n a O l g a , C e r n o b b i o , L a k e C o m a , I t a l y . S p o n -s o r: A s s o c i a t i o n o f S I M U L A U s e r s . C o n t ac t :E i l e e n S c h r e i n e r , N o r w e g i a n C o m p u t i n g C e n t e r ,P o s t b o k s 3 3 5 . B l i n d e r n , O s l o 3 , N o r w a y .8 N o v e m b e r 1 9 7 9A n n u a l W e s t e r n S y s t e m s C o n f e r e n c e , L osA n g e l e s , C a l i f . S p o n s o r : A s s o c i a t i o n f o r S y s t e m sM a n a g e m e n t . G e n . c h i n : S y l v i a T w o m e y , 1 8 70 0Y o r b a L i n d a B l v d . , A p t . 47 , Y o r b a L i n d a , C A9 2 68 6; 7 14 9 9 3-67 30 .

    2 7 -3 0 N o v e m b e r 1 9 79C A U S E N a t i o n a l C o n f e r e n c e , P l a n n i n gH i g h e r E d u c a t i o n I n f o r m a t i o n S y s t e m s f o r t h e1 9 8 0s , O r l a n d o , F l a . S p o n s o r : C A U S E . C o n t a c t :C A U S E , 7 3 7 T w e n t y - N i n t h S t . , B o u l d e r , C O8 0 30 3; 30 3 4 9 2 -7 35 3 .1 4 -1 5 F e b r u a r y 1 9 80 A C M S I G C S E T e c h n ic a l S y m p o s i um o nC o m p u t e r S c i e n c e E d u c a t i o n , K a n s a s C i t y , M o .

    S p o n s o r : A C M S I G C S E . C o n f . c h m : W i l l i a m C .B u l g r e n , D e p t . o f C o m p u t e r S c i e n c e , T h e U n i -v e r s i t y o f K a n s a s , L a w r e n c e , K S 6 6 0 4 4; 9 1 3 8 6 4-4482. 12 -14 M arch 19 8 0I n t e r n a t i o n a l S y m p o s i u m o n D i s t r i b u t e dD a t a b a s e s , V e r s a i l l e s , F r a n c e . S p o n s o r : I R I A .C o n t a c t : S y m p o s i u m S e c r e t a r i a t , I R I A , S e r v i c e sd e s R e l a t i o ns E x t & i e u r e s , D o m a i n e d e V o l u c e a u -B P 10 5, 7 815 0 L e C hes n ay , F ran c e .19 -2 1 Marc h 19 8 0 1 3 th A n n u a l S i m u l a t i o n S y m p o s i u m , T a m p a ,F l a . S p o n s o r s : A C M S I G S I M , I E E E - C S , S C S .S y l n p . c h i n : H a r v e y F i s h e r , A l e a n P r o d u c t s , B o x5 1 1 , W a r r e n , O H 4 4 48 2 ; 21 6 8 4 1 - 3 41 6 .2 8 M a r c h - 3 A p r i l 1 9 8 0S i x th I n t er n a t io n a l A L L C S y m p o s i u m o nC o m p u t e r s i n L i t e r a r y a n d L i n g u i s t i c R e s e a r c h ,U n i v e r s i t y o f C a m b r i d g e , E n g l a n d . S p o n s o r : A s -s o c i a t i o n f o r L i t e r a r y a n d L i n g u i s t i c R e s e a r c h .C o n t a c t : J . L . D a w s o n , S e c r e t a r y , 1 9 8 0 S y m p o -s i u m , L i t e r a r y a n d L i n g u i s t i c C o m p u t i n g C e n t r e ,S i d g c w i c k S i t e, C a m b r i d g e C B 3 9 D A , E n g l a n d .2 M a y 1 9 8 0 R o l e of D o c u m e n t a t i o n in t h e P r o j e c t L i f eC y c l e , N e w Y o r k C i t y . S p o n s o r s : A C M S I G D O C ,S I G C O S I M . C o n f . c h m : B e l d e n M e n k u s , B o x 8 5,Middlev i l l e , NJ 0 7 8 5 5 ; 2 0 1 38 3-39 2 8 .19 -2 2 M ay 19 8 0 N C C 8 0 , A n a h e i m , C a l i f . S p o n s o r : A F I P S .C o n t a c t : J e r r y C h r i f f r i l l e r , A F I P S , 2 1 0 S u m m i tAve . . M o n tva le , N J 0 7 64 5 ; 2 01 39 1-9 810 .3-6 J un e 19 8 04 t h I n te r n a ti o n a l I F A C C o n f e r e n c e o n I n -

    s t r u m e n t a t i o n a n d A u t o m a t i o n i n t h e P a p e r ,R u b b e r , P l a s t i c s , a n d P o l y m e r i z a t i o n I n d u s t r i e s ,G h e n t , B e l g i u m . S p o n s o r : I F A C . C o n t a c t : 4 t hI F A C - P . R . P . A u t o m a t i o n C o n f e r e n c e , J a n V a nR i j s w i j c k l a a n , 5 8 , B -2 0 00 A n t w e r p , B e l g i u m .16-18 J un e 19 8 0I F A C / I F I P S y m p o s iu m o n A u t o m a ti o n f orS a f e t y i n S h i p p i n g a n d O f f s h o r e O p e r a t i o n s ,T r o n d h e i m , N o r w a y . S p o n s or s : I F A C , I F I PS I N T E F , N o r w e g i a n P e t r o l e u m D i r e c t o r at e . C o n -t a c t : S I N T E F , A u t o m a t i c C o n t r o l D i v i s i o n , N -7 0 34 T r o n d h e i m - N T H , N o r w a y .

    P R E V I O U S L I S T I N G S15 -2 0 J u ly 19 7 9I n t e r na t i o n a l U s e r s ' C o n f e r e n c e , C a m b r i d g e ,M a s s . S p o n s o r: H a r v a r d U n i v e r s it y L a b o r a t o r yf o r C o m p u t e r G r a p h i c s a n d S p a t i a l A n a l y s i s .C o n t a c t : K a t h l e e n Q u i g l e y , C e n t e r f o r M a n a g e -m e n t R e s e a r c h ( c o n f e r e n c e c o o r d i n a t o r s ) , 8 5 0B o y l s t o n S t ., C h e s t n u t H i l l , M A 0 2 1 6 7 .16-18 J u ly 19 7 91 9 7 9 S u m m e r C o m p u t e r S i m u l a t i o n C o n f e r-e n c e , T o r o n t o , O n t . , C a n a d a . S p o n s o r s : S C S , I S A ,A M S , S H A R E . G e n . c h i n : A . J . S c h i e w e , c / o T h eA e r o s p a c e C o r p . , B o x 9 2 9 5 7 , L o s A n g e l e s , C A9 0 0 0 9 ; 2 13 64 8 -612 0 .16-2 0 J u ly 1 9 79S i x th I n t e r n a t io n a l C o l l o q u i u m o n A u t o -m a i n , L a n g u a g e s , a n d P r o g r a m m i n g , T e c h n i c a lU n i v e r s i t y o f G r a z , A u s t r i a . S p o n s o r : E u r o p e a nA s s o c i a t i o n f o r T h e o r e t i c a l C o m p u t e r S c i e n c e .C o n t a c t : H . M a u r e r . I n s t i t u t f l i t I n f o r m a t i o n s v e r -a r b e i t u n g , T e c h n . U n i v e r s i t ~ i t G r a z . S t e y r e r g a s s e1 7, A - 8 0 1 0 - G r a z , A u s t r i a .18 -2 0 J u ly 1 9 79F i f t h S o u th A f r i c a n S y m p o s i u m o n N u m e r i -c a l M a t h e m a t i c s , U n i v e r s i t y o f N a t a l , D u r b a n ,S o u t h A f r i c a . S p o n s o r : U n i v e r s i t y o f N a t a l . C o n -t a c t : H . R o l a n d W e i s t r o f f e r , C o m p u t e r S c i e n c e

    D e ~ t . . U n i v e r s i ty o f N a t a l . K i n g G e o r g e V A v e -n u e , D u r b a n , 4 00 1 , R e p u b l i c o f S o u t h A f r i c a .2 7 -2 9 J u ly 19 7 9S e m i n a r o n S c i e nt i fi c G o T h e o r y ( w i t h E u r o -p e a n G o C o n g r e s s 1 9 79 ) n e a r B o n n , W . G e r m a n y .C o n t a c t : K l a u s H e i n e , K l e i s t s t r . 6 7 , 2 9 4 W i l -h e l m s h a v e n , W . G e r m a n y .6 - 8 A u g u s t 1 9 791 9 7 9 P a t te r n R e c o g n i t i o n a n d I m a g e P r o c -e s s i n g C o n f e r e n c e , C h i c a g o , I l L S p o n s o r : 1 E E E -C S . C o n t a c t : P R I P 7 9 , B o x 6 3 9 , S i l v e r S p r i n g , M D .6 - 8 A u g u s t 1 9 79S e v e n t h C o n f e r e n c e o n E l e c tr o n i c C o m p u -t a t i o n , S t . L o u i s , M o . S p o n s o r s : A S C E . W a s h i n g -t o n U n i v e r s i t y . C o n t a c t : C . W a y n e M a r t i n , 2 1 2B a n c r o f t B l d g . , U n i v e r s i t y o f N e b r a s k a , L i n c o l n ,N E 6 8 5 8 8 .6 - 1 0 A u g u s t 1 9 79 S I G G R A P H 7 9 , S i x th A n n u a l C o n f e r e n c e o nC o m p u t e r G r a p h i c s a n d I n t e r a c t iv e T e c h n i q u e s ,C h i c a g o , I1 1. S p o n s o r: A C M S I G G R A P H . C o n f .c o - c h i n : T h o m a s D e F a n t i . B r u c e H . M c C o r m i c k ,D e p t . o f I n f o r m a t i o n E n g i n e e r i n g , U n i v e r s i t y o fI l l i n o i s a t C h i c a g o C i r c l e , B o x 4 3 4 8 , C h i c a g o , I L60 68 0 ; 312 9 9 6-2 315 .6 - 1 0 A u g u s t 1 9 79 A C M S I G P L A N S y m p o s i u m o n C o m p i le rC o n s t r u c t i o n , B r o w n P a l a c e H o t e l , D e n v e r , C o l o .S p o n s o r: A C M S I G P L A N . C o n f . c h m : F r a n A l -l e n, I B M T . J . W a t s o n R e s e a r c h C e n te r , Y o r k -t o w n H e i g h t s , N Y 1 0 5 9 8.1 1 - 1 2 A u g u s t 1 9 79A s s o c i a t i o n f o r C o m p u t a t i o n a l L i n g u i s t i c s1 7 t h A n n u a l M e e t i n g , U n i v e r s i t y o f C a l i f o r n i a( S a n D i e g o ) , L a J o l l a , C a li f . S p o n s o r : A C L . C o n -t a c t : D o n a l d E . W a l k e r , A C L S e e ' y - T r e a s . , S R II n t e r n a t i o n a l , M e n l o P a r k , C A 9 4 0 2 5 .1 3 -1 5 A u g u s t 1 9 79 C o n f e r e n c e o n S i m u l a t i on , M e a s u r e m e n t ,a n d M o d e l i n g o f C o m p u t e r S y s t e m s , B o u l d e r ,C o l o. S p on s o rs : A C M S I G M E T R I C S , S I G S I M ,N B S . C o n f . c h i n : P a u l F . R o t h , N a t i o n a l B u r e a uo f S t a n d a r d s , A - 2 6 5 T e c h n o l o g y B l d g . , W a s h i n g -to n . DC 2 0 2 34 .1 6 - 1 7 A u g u s t 1 9 79 S I G C P R 1 6 th A n n u a l C o n f e r e n c e o n C o m -p u t e r P e r s o n n e l R e s e a r c h , P r i n c e t o n , N . J . S p o n -s o r: A C M S I G P C R . C o n f . c h m : T . C . W i l l o u g h b y ,M a n a g e m e n t S c i e n c e . C o l l e g e o f B u s i n e s s A d -m i n i s t r a t i o n . B a l l S t a t e U n i v e r s i t y , M u n c i e , I N4 7 30 6; 317 2 8 5 -12 65 .1 6 -1 8 A u g u s t 1 9 79I F A C S y m p o s i u m o n C o m p u t e r A p p l i c a ti o n sill L a r g e S c a l e P o w e r S y s t em s , B a n g a l o r e , I n d i a .S p o n s o r : I n t e r n a t i o n a l F e d e r a t i o n o f A n t o n a a t i cC o n t r o l . C o n t a c t : I n s t i t u t i o n o f E n g i n e e r s , 8C o o k h a l e R o a d , C a l c u t t a - 7 00 0 2 0 , I n d i a .

    1 9 -2 2 A u g u s t 1 9 793 r d R o c k y M o u n t a i n S y m p o s i u m o n M i c r o -c o m p u t e r s , P i n g r e e P a r k , C o l o . S p o n s o r : C o l o r a d oS t a t e U n i v e r s i t y . C o n t a c t : C a r o l y n F r y e , O f f i c eo f C o n f e r e n c e s a n d I n s t i t u t e s , C o l o r a d o S t a t eU n i v e r s i t y , F o r t C o l l i ns , C O 8 0 5 2 3 ; 3 03 4 9 1 - 6 2 22 .1 9 -2 4 A u g u s t 1 9 79S e v e n t e e n th A n n u a l U R I S A C o n f e r e n c e , S a nD i e g o , C a l i f . S p o n s o r : U r b a n a n d R e g i o n a l I n -f o r m a t i o n S y s t e m s A s s o c i a t i o n . P r o g . c h i n : L e eP . J o h n s t on , U R I S A C o n f . P r o g . C h m . , 82 3 M o n -t i c e l l o D r i v e , E s c o n d i d o , C A 9 2 0 2 5 .2 0 -2 2 A u g u s t 1 9 79F o u r t h I n t e r n at i o n a l C o n f e r e n c e o n C o m -p u t e r s a n d t h e H u m a n i t i e s , D a r t m o u t h C o l l e g e ,H a n o v e r . N . H , S p o n s o r s: D a r t m o u t h C o l l e g e a n dt h e A s s o c i a t i o n f o r C o m p u t e r s a n d t h e H u m a n i -( C a l e n d a r c o n t i n u e d o n p . 4 3 9 )

    4 3 6 C o m m u n i c a t i o n so fthe ACM

    J u l y 1 9 7 9V o l u m e 2 2N u m b e r 7