on folk theorems - david harel

Upload: exfenestracide

Post on 08-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 On Folk Theorems - David Harel

    1/11

    Art ic leO n F o l k T h e o r e m sD a v i d i t a r e lI B M T h o m a s J W a t s o n R e s e a rc h C e n t e rYork towr~ Heigh ts , New York

    - - ~ i f e d a a r e s ug \g e si ed f b r g g a w e p r e f e r a n d w it~ a d o p t t h e s e c o n d a p p r o a c h . A c c o r d -s t a t ement i s a fo lk t heorem~ The ideas a re t : he~i l l us t r a t ed w i~h a de t a i l ed exam ple f rom the t he ory ofprogram.mi~g.

    K e y W o r d s a n d P h r a s e s : f l o w c h a r t , f o l k t h e o r e m ,s tn~ tu red p r~gammlng , whi t e -p rograms

    CR Ca tegor i e s : 2 ,1 , 4 ,2 , 5~ :N

    1 . I n m M u c d n nl ;>lkl~)ee: Th e ~ rad i~o r~a i ~ I ie f s , l e g e n & an d

    c~ io m s c~rercn~ amor~g c o m m o n peopie.......T h e O x f o g d g n g ~ i s k D i c t i o n a r y

    7 ; ~ e o r e m : A g e n e ra l c o n c lus io n wh ic h h a s be e n pro v e d,....... M ad , ema~i~::s Dt ct io na

  • 8/6/2019 On Folk Theorems - David Harel

    2/11

    4 e 6 n m o n o f / } d ~ o ~ : q u o : e d s : ~ h s:a:":: k ~ a f : e : . u m o n gc o m m o n p e o [ : @ " i m p h e > p , % A a r n y . " b < : h e A + } e ~ : e n d sa : ~ d : ; u s: o s :~ s ~ ~ n d : c a : e s a n o n y t n e : . ~ , s ~ : : :: h w ' q : : p + a n d ~ ' m :. +d @ o n a F + a d d s . { h e d:memo~ on o} :H::

    v ~ h e : : : q , : ~ g : o d a + J , , @ e : : ~ e h r : : e ~ :~ p c< {> < d { : a > & : :@ e r a f : o m @ e : e M m a : o { : e l l :r i g a le :. ~ r i d r a g : r i g ~ , " n g >: o : h a : o f p : o ~ : : : g @e o : e n : :, : : { : s h o u : d h < n o s e d :h~:~:n e H h e : o n e ~ n oth e r a{em e{~ : whic h > he : rag p :o~ ed+ T h i sbring:+ +a.s ~o :he +R4{,en ha ve m a n y vem:oa::s++ ph on em e+non. . w hi ch :s ck+,-se~y re:aRx+ ~o pc~p@ar+:y Su re:y+ w ::h~ he s i z e o f o u r : e s e a r e h c o m m a . b a i t : k~@'~gw h a : ~: as.+s h e Lc o : : :p a c { s : a : e m e n t ' s o f { h e o v e m s : e n d : o be ~e.memb~+rede v e n b y p m o p : e n o : + a o r k m g i n { h e a d u a : a r ea ++ + ~ea+~.,hg ++ 'a rn :s o m p + ~ : e e ~ e o 1 h / i n + ~" : s { n : : c h m o r e ca:ch}+ amda p , ~ e a h : g :~a:::: s EbvK>~5 :go:+:>:~s c e : ~ n : e r p a r t S:a+Jngs:~ch a + h e o r e : i : : h i s f o a m ~+e.a: : ) { a e r i e s ~:,:~ pop:+++~a.: hy a a d w+:~+:hh c h a : c e s o f ff,s b~ecommg a +1ege: :d ~o r % , . r e p l y a { :e lk the e ; e ra Th e vague~m ~+ m a :~::+~em%+~a~emer+: can t h ~ s g + v e r i s e ~ o m o r e : h a r t o n e { l e g a l )

    : o f ++ a m d ~ a i : h ~ a m e s t o o + f : : m am d m o : ew be :: e ~ h ++:'e:~i: eq u i: es a ~'. ~ : n g I y d i b : e s :

    p:re&> ( 'The >cade t > adv i :~ sd no : {0 coRf~/:se s~c~ {b{kff :eo~erns w h h +: : a~e me ~+ w h i c h are ge~e~ ic Le .+ s ta:e+me~> s thag are e+x de +. . i be ~a: e~y a ~%>>m f : ~ o r nw :h kh :maav.+, ~ea.: :he-orem++ {:re gi v en a~ m:em)+ Th+ :o{x+~ o f a 6;Ak ~hec+:emm ig ht axe bmr: ie+] im + m e o ~ + m m kc ~+ :e r+o+e m a +e: :e :{o aa +~dm>:+o + +or+e+ i m a + p r i v a: e c + m m + n i v a : F m F + hi s ~ a a l y ~ s i B k , i f' < m s i.:+ + i f : ra g m p + a: < a m h+~+ A+e x+{a:e)+++++?+ + + : i + + :ho+< ++:+:+{ m k s: +: ~ + , em prm : )+ : ho+gh ++m i d++++ +h e ~ : > f :+~(h/: ++~: % : ' H 1 4 : 1 ~ 1 : hc :>4: :: ot+ ~ )y. :{V : CAM~P{ IH :d +::: $::':i:U+: : l C { : / h H : {}Wig ~: ~k , ,+, {~

    } n

    "+:'c.'~] { ( : k : : : : ' < : : {~fied . : ,~ d ~ h o u { d t w +v~a:-dcd, ,, > p a r : o +: h e C : : ~ : : : f ~ :}Hg a m a : c : : r h l ~ {o ~ : a 1 : n : \ {h~:% ::oco;:::e

    h o b { > ~:~ch ~+o , ~ : a n : p c o H e c a + n } {} { e s c ~ ~ h : i e : h e p ~ > :> , , au ( h- + : p r o { ~ c r : : e s + e c r u : v ~ ,

    ~ e < e s s . ~ w s : r i d a 4 ~ [ l ~ c i e : : I . t ~ + n d i h o ~ , - ~%.>~ o t ~h e ~w : ;s :. :n { 0 b o me O f d e e p ~ b h s h e d

    ~ x : v s o f + h e t h e o re m + w h i c h w e m e n ~ i o n : :~ ef + a tea : : : : i b ;~ed by :heap :~{ho~s :o { :5 :~ a h h o t + g h , a s w e + h a l

    (:~e~ ~+,s~ema+~ here d:a+ :h~;~ m a d o ~ h et p h e n o m e n ad ~ e d m C D : se%~el are {0 ~ { a ~ e ~ a 5 ~ a { h e , am m +i~gm g m i > ~ ) m s o f ~ h + b e e a n d k g e n d O f o u r y O ~ m g g e k La ~ : { b y r~o : : v e a a + a : e ~hey m~c . i : ~m o f ~ h + h

  • 8/6/2019 On Folk Theorems - David Harel

    3/11

    inwAved~ We wi t t do o,~r bes t to convey this spi r i t to thereade r a s we go a long . )

    P,e t~: rmng t o o~.~r topic , we n ote that the th eo rempro ved m the f i rs t par t of '{~ 5] asser ts that , wi th addit ior~alBoolea~~ va~iabtes ~, ever) , f low char t i s equ iva tem to awhib ~pro gram {with, i n ge t, o raL more t han one occ ur -re~ce o f wNle~de )~ Ha ving p rov ed the f i rs t "s t ruc t t~ r ingr e s ~ / f ' o f it s k in d~ B o h m a ~ d J a c o p i n i ' s w o r k h a s b e c o m ei m m o r t a l iz e d a s c o m a i n i n g " t h e m a t h e m a t i c a l j u s t if i c a -t icm t i) r s t r t i c tu red p rogra mm ing ," t o pa raphrase ma nyat~thor~ ors the subjec t . The resul t ing tmiversal popular i tyof {15] , the ~i~ct that du e to i t s ra ther techn ical s ty le i t isapparea . t l y m ore o t~e ta c i t ed t han read in de t a i l and , o fc o u r s e t h e s i m i l a r i t y o f t h e t h e o r e m p r o v e d i n I 1 5 ] t ot h e o n e w e a r e i n t e r es t e d i n s e e m t o b e s o m e o f t h ereasons ~k?r t h i s com m on reac t ion .

    Bo hm and J a cop in i p rove t he i r r e su lt by .p rov id ing~ l o c al " t r a n s % r m a t i o n s o n t h e v a r i o u s k i n d s o f f l o w -char t s po s s ib l e , l e ad ing to t he f i na l s t ruc tu re d w hi le -%mx,which involves on ly s equ enc in g ( ; ), condi t i ona l s ( if*then-e t s eL and i t e ra t i on (whi l e -do) . Pu t ano the r way , t he i rp r o o f i s b y i n d u c t i o n o n t h e s t r u c tu r e o f a fl o w c h a r t. T h eB o o le a n. v a r ia b l e s a r e u s e d t o " m a r k " p a t h s t a k e n b y t h ec o m p u t a t i o n , m o r d e r t o r e m e m b e r t h e m l a t e r .W e c a n p o i n t t o t h r e e s u b s e q u e n t p a p e r s i n w h i c hs i m i la r p r o o f s o f t h e B 6 h m a n d J a c o p i n i r e su l t a p p e a r ;nam e ly , Mi l l s {67] , and Cu t ik [24 , pp . t% t9 ; 25 , pp . 11 -t4 ] . Indeed , i t s eems tha t H.D. Mil l s who, i n h i s unpub-l i shed l ec tu re no t e s , t e rmed the r e su l t o f [151 "The S t ruc -t u r e T h e o r e m " w a s o n e o f t h e d r i v i n g t b r ce s b e N n d t h eg l o r i fi c a t io n o f B 6 h m a n d J a c o p i n i ' s r e su l t, w h i c h h erep ro ved a nd d is cusvsed in h igh ly a t t end ed l ec tu re s a nds e m i n a r s i n t h e f o B o w i n g y ea r s .

    t t is in t e r e st i n g t h a t p r m s e l y w h a t i s n e e d e d i n o r d e rto ex t end th i s ve lT p r o o f to o n e p r o v in g o u r F o l k T h e o -r e m c a n b e % a n d i n M i r k o w s k a ' s 1 9 7 2 t h e s i s i n P o l i s habou t a lgor i t hmic l og i c [70] .~ T h e " n o r m a l f o r m t h e o -r e m " o f [ 70 ] s t a te s t h a t w i t h a d d i t i o n N B o o l e a n v a r i a b l e s( o f t h e k i n d a l l o w e d i n [1 5] ) e v e r y w h i l e - p r o g a m i se q u i v a l e n t t o o n e i n w h i c h w h i l ~ d o o c c u r s o n l y o n c e .T h e p r o o f , w h i c h i s a l s o b y i n d u c t i o n , p r o v i d e s l o c a lt r a n s f o r m a t i o n s w h i c h s e r v e t o e l i m i n a t e n e s t e d a n dne igh bor in g whi l e 's and m d i s t r i bu t e w hi l e -do ove r if -t h e n - e ls e . A s a m p l e t r ~ s t b r a l a t i o n a p p e a r s in th e A p -p e n d i x . T o M i r k ow s k a ~ s p r o o f o f w h a t w e m i g h t c a l l t h es e c o n d h a l f o f o u r T h e o r e m , a c o m p l e t e p a p e r b y P e r -kowska [77 , p . 441 t was devoted two yea r s l a t e r . A th i rde x p o s i t i o n o f t h is p r o o f a p p e a r s i n a p a p e r b y K r e c z ~ n ar[55 , pp . 23 -24} which dea l s ma in ly w i th i n t e re s t i ng bu tcom ple t e ly d i f f e ren t i ssues~

    T h u s , w e h a v e f o u n d t h a t B o h m a n d J a c o p in i | 1 5 |a re no t t o be det~vched ~om our i nves t i ga ti on , s i ncebes ides be ing the f i r s t t o p rove a "s t ruc tu r ing r e su l t " andthe f i r s t, i t s eems , t o i l l u s t r a t e som e of t he po we r of

    T h e s e c a n t a k e o n o n e o f t w o d i s t r a c t v al ~e s ~ d i s t in g m s : h a b l e b ya te s t:~ N~ t ha vi ng 170~ ir~ {?o~t of ~s , we re ly he r e ot~ p~zrse~aI eom -m u a i c a t i o ~ w i ~h M i r k o w s k a a ~ d o n t h e r e f e ~ m c e in [ 55 /.

    Boolean va r i ab l e s , t he i r work toge Ihe r w i th t ha t o f Mk o w s k a [ 70 ] c a n b e i n t e r p r e t e d a s a c o m p l e t e p r o o f o u r o w n T h e o r e m . I f o n e p r e fe r s s y m b o l s o v e r w o rand i s w i l li ng , fo r t he mo men t , t o ove r look p r io r i t i e s ~avor o f doc um ent in g p roofs appea r in g in p r in t, omight a ssc~z ia te t h i s p ro of o f t he Fo lk T heo rem wi th([|51 V {67] ,,./{24] .,/I251)/'-. ([7O] V [771 ' [551),w h e r e " V " a n d " A " s t a n d , re s p e c ti v e l y , % r ~ b r " a n*'and."

    N o w , a l l t h i s s o u n & l i k e c o m p l i c a t e d m a t h e m a t i cr e s ea r c h c o n c e r n i n g a r a t h e r d e e p r e s ul t % r w h o s e p r othe eff or ts a nd par t ia l rose , I ts of a t leas t two re searche rwork ing s epa ra t e ly and , i ndeed , i n d i f f e ren t count r i ewere need ed . Th e rea l f inn i n i nves t iga t i ng t h i s The ores t a r ts wh en o ne r ea l i ze s t ha t t he re i s a com ple t e ly d i f f ee n t, M m o s t t r iv i a l w a y o f ' p r o v i n g t h e T h e o r e m a n d t h af u r t h e r m o r e , i t i s w i t h t h is p r o o f t h a t t h e n a m e s o f B 6 ha n d J a c o p i n i a r e o t l e n e r r o n e o u s l y a s s o c i a t e d . T h"g loba l " p roof , g iven more r r i gorous ty i n t he Appendii n v o l v e s c o n s t r u c ti n g a s i m p l e o n e - l o o p p r o g r a m w h i cs t a r t i ng w i th t he f i r s t "box" i n t he o r iNna l f l owchare x e c u t e s o n e s u c h b o x e a c h t i m e a r o u n d t h e l o o p . U p ocom ple t ing t he execu t ion o f a box , a va r i ab l e i s s e t t o t hindex o f the fo l l owing box in t he o r ig ina l f l owchar t . (Foa t e s t box , an i f - t hen-e l s e accompl i shes t h i s fo r t he twp o s s i N e o u t c o m e s . ) C o n t r o l t h e n r e t u r n s t o th e b e g i n m no f th e l o o p . T h e b o d y o f t h e l o o p , w h i c h i s e x e c u t e d u n tt h e i n d e x o f t h e o r i g in a l S T O P b o x i s d e t e c te d , s t arw i t h a n e s t e d s e t o f c o n d i t i o n a l s w h i c h t e st t h e v a l u e ot h is o n e n e w v a r i a b l e a n d b r a n c h t o t h e a p p r o p r i a t e b oaccord ing ly . S ince any f l owchar t con ta ins on ly a f i n in u m b e r o f b o x es , t h e n e w ( n u m e r i c a l ) v a r i a b l e c a n bs i m u l a t e d b y a f i n it e n u m b e r o f B o o l e a n o n e s , g i v in g t hT h e o r e m .

    I t i s i n t e re s t i ng t o no t e t ha t bo th t he l oca l t r ans fom a t i o n o f B 6 h m a n d J a c o p i n i [ l 5 ] a n d M i r k o w s k a [ 7 0a n d t h e a f o r e m e n t i o n e d g l o b M o n e f a i l, b y t h ei r v ena tu re , t o p re se rve t he s t ruc tu re o f t he o r ig ina l f l owcharI ron i ca l l y , t hough , t hey a re p roofs o f a so-ca l l ed "s t ructu r ing r e su l t . "Bu t l e t u s con t inue our i nves t i ga t i on , be ing cu r ioua s t o w h e t h e r w e o u r s e lv e s , b y v i r t u e o f h a v i n g j u sp re sen t ed t he g loba l p roof , a re t o p l ay a cen t ra l ro l e it h i s l it t le t a le . W e sha l l c l ea r ly be d epr ive d o f t h is i f t hp ro of has ap pea r ed in p r in t e ar li er~ " 'App eared , " d id wsay? Yes . i t has app ea red . Bu t t ha t wou ld s eem to be r a the r mi ld word to a s soc i a t e w i th t he s i t ua t i on we nowse t ou t t o desc r ibe .T e x t b o o k s a r e a g o o d p l a c e t o st a rt . A n d . i n d e ed , one b rowses t h rough the boo .ks pub l i shed in t he gene raa r e a o f s t r u c t u r ed p r o g r a m m i n g , o n e f i n d s tw o w h i cc o n t a i n t h e a b o v e p r o o f : M c G o w a n a n d K e U y in 1 9 7[63, pp. 62-64] and more recent ly , in 1979. Linger , Mil lsand Wi t t [60 , pp . 118-120 l~ A s imi l a r s can o f books of m o r e t h e o r e t ic a l n a t u r e r e v e al s tw o m o r e o c c u r r e n c e s ot h e p r cu 3~ ? G r e i b a c h ' s 1 9 7 5 m o n o g r a p h o n p r o g r a mschem es [38, pp . 4 .52 -4 .53 ] and C |a r k and Cow e l / ' s f97

    3St C o m m u n k a l i ~ r ~ s J M ~ t q S 0of V o l e -me 2 3l h e A C M N u m b e r 7

  • 8/6/2019 On Folk Theorems - David Harel

    4/11

    inm::~daclor? ~x~ {20, pp . 61.~.,63}. t~ is ~:~o~ewon hyt h a n ma ll f b ~ r c a :d e s h e t h e o r e m s ~ a { e d ~ s ~ h e B o h m a n d J a c o *pm i on e {and he nc e i~ amibt~t ior~ in [(~31 an d {38] 4o{151L bm ~he global pro~:~fm a k e s ~:~e of on ly one ~h ik ,~~ and so p r o v e s m e t s t r o n g e r F o l k T h e o r e m ,

    Since an po ime rs ~o ~he o r ig in o f ~he pr have ~ e n es~ar~ti af~yr e i n v e m e d b y : t h e autho:cs o f ~ he se b o o ks . R e i n v e m e d ,t h a t is , i f w e c a n f i n d i~ ooc:~ar ring n p r im even ear l i e r .

    Lea ping f rom hooks ~o e~aos te~ers, a re ade r l eaf ingt h r o u g h ~ h e F e b r u a U 1 9 7 5 i~ s~ e o f S I G P L A N N e ~ c esno t i cvs a tw o-pa ge pap er b y P lum {79 pp~ 32-331, mw h w h t h e a ~ h o r , t e r m in g th e u se o f ~he Bohm aq~d1acnp in i {{ 5] m m h~ l *~ma~hema~ica{ overk i lL" presem:sa % ; imp{e pr oo f o f th is s i m p k ~ : s u t t '- - - 4 h e g l o b a l p re en {a b c w e O n e f i n d s i~ h a r d { o ~ { i e v e , t h o u g h , that 1:4 ~ookN m o s ~ r u n e y e a r s f i? r ( h i s o b s e r v a a o n ~o f ind i t s way ~ot h e p r i n t e r .

    W e r n u N t u r n , i~ s e e m s , ~o o n e o f c o m p m e r s c ie n c e 'ss . ta a d a r d o r a c l e s: D , K m ~ . h ~ s ~ d ~ o N r ty s u r ~ e y p a ~ rpubt : iahed m 1974 [52} , k~side :s con ta in i~g m uc h sm nu -la tmg ma4e~ia l concern ing ~he (non - ) v N u e o f re~sattssac h as o~ar T ~ o re m , coaf ir rcc~ o :a r s~spic inn b y re duc ings h e a i n u y e a r s ~ o s a g h d y o v e r o n e ; i n { 5 2 po 2 7 4t w e f i n do u r s i x th ~>ccurrer~ce f { h > p r o n e b ~ h e r e is i s a ~ t d b m e dp r i m a r i l y ~o * '~ he c o m m e m s m a d e b y C o o p e r m { % 7 " mhis t e rse r {221 m ~he ed i to r o f f f~ is o u rn a l Inde ed , D~CoC o o p e r { 22 ! ( e i gh t y e a r s , w e m ~ h t a d d , ~ f o r e ~ he N 1 n ~ident ica{ {79~) not es ~hat ~*a red{radon [ thaa~ tha io f B 6 h m a n d J~oDed} is ~.siNe0" a n d s ~op r o v e o u r F o l k T h e o r e m ~ he g l o b N w a y .

    A nd so , w e ar e exp~vsed ~o wh at seem ~o be the f in s, ;s t ages i .n ~he evo lu t ion o f ' arm au th em ~ J!;a ik th eo ~m : Asa r e a c t i o n ~ o f f~ e j o u r n a l p u b t i c a ~ m n o f a p r o o f o f h a l f~he theo r em , an acqmos t ~f iv .i at p r oo f o f ~he w ho le i s

    t e d m a l o n e r m Ih e e d k o n a n d m a n y s u bs e- qe en ~a m b e r s , n o t i ha v m g s e e n {~he a f o r e m e n ~ m e d t e ~ e r ( i n -d e e & o n e d o e s n o t e x p e ct t h e m m h a v e s t u n i 0 t h e np ro >c ue d ~ o r e m v e m ~ he p r o o f t h e m s e l v e s

    Th in s i tua t ion i s en ihanced by ~he ha l lowing add i~m aalf i v e p a p e r s , a l l o f w h i c h p ~ e ~ m C ' . c a ~ p e f s proof : A.shcrof{a n d M ~ n a a ' s t 9 7 / i F t P S p a ~ f o n r% rq ac in g g a t e ' s b y

    ({2~ p. {4 8/; se e a ls o {3, po 14 0t),, @~e ~i m ita r b~a~m d e p e r ,d e m I 9 7 2 p a p e r o f B r u n n a n d S t e ig t it z { 17 ,p . 52 l} , Wul fs 1972 < ~ c ~ again:st {he gor e" [87~ pp. 64--67]~ Mi l l 's {975 jou rna l ve rs ion o f ORe S~r 'uc ,~re T he or emI6 & p . 4 5 ] . a n d t h e a p p e n d i x ~ o ( ~ e ~ 9 7 7 p a p e r o n r e t i a N e~;~og~am.s o f L i n e r a r id M i l s ~59, pp~ ~3 ,6-139] . O f these ,.[2, 68, 59 t credi~ C o o e r with ~he 1:man{, {{7~ N ves thep r ~ f w i t h o u t c re d.i ~ b m t h e ~ h e o~ e m ~ g a{ ed a Ih e v ~ a k e rg6 hm ar id J ve rs ioe , ru th c red i t m ~hem, and [87]in a wa y kypica i o f / he Mk ishm:~ s o f {he e .i~a .a~ioecr~i ;gs[ { 5] w i t h ~ h e ver3io~a~S i m i l a r l y t y D c a L b y ~ : e w a y , g D e f in i ng 's , S~ p t e m ~ a. r{975 nm p4aim {27] ag~ou~ Pb~m'~ F eb m a U t975 N ~ rt791: " ly dh4s co r~macdor~ w as su gges ted by Br ,ano

    and S4{eg{az i a I972 . - Den mng ' : , a rg ~m em cars ~c~.~al~ym ad e 6 re ye ars s t retche r by re{Erring ~o ( 'oo~:~:r!It is also wovd ~ re m ar kin g tha4 m I2, p t49; 3 , pp~

    1 4 t . 142] Ash cro f l a~ d Mam~a. b e ing im eres ted m s4rt~c,~4uri r~g res t~ l ts wh ic h prese rv e so me o f th e sm ~c ~r e o f ~}~eo r i g i n a l f l o w c h a r t , p r o v i d e m a d d : ~ i o n a s l i g h d y m o r ec f f i c i e m v a r t a m o f ~ hc g l o b a t p r oo f: , w h i c h t h e y a t m b m ea t s o ~ o C o o p e r , i n w h i c h w h a l o n e m i g h t c a / / a ~ m a x i m a { -l o op ~ f re e '" c o m p o n e n t o f d i e f l o w c h a r t ( a~ o p p o s e d s o as ing le box} i s exe cute d ea ch ~{me amur~d ~he kmp.

    No w. ever , f f we w ere to end om s~ory here , the re i s~o dnub~ tha t we could qui t e sa{~ty ~erm dds rea td t a{bik the o rem . As i~ ~urns ouL 4hough , o t~r tml e gam e ~ i sf ~ r f r o m b e i n g o v e r .A ~ t h is , p o i m w e v e m u r e o ~ r o p i n i o n t h a t t h e g l o b a lp r o o L a n d h e ~ c e o r e T h e o r e m i u se iL i s a c t u a l l y r o o4 e dm { he e a r l y w o r k o f Jo bm v o ~ N e u m a n n o n ~ he s t r u c t m eof digi~M mpu~ers~ In Sec~io~ 6 o f h is 19 46 (!) jo imp a ~ r w i~ .h B ~ r k s a n d O d d s { i n n {18/, ~ :he idea o f exe cut -i ng a p r o g a m o n a c o m p m e r b y m e a n s o f a N r g e k> opw h i c h c a m e s o u ~ a n i n s t r u c t i o n a ~ a ~ im e is d e s c r i b e d . Ap r o g r a m c o n t o u r i s u ~ a ~ e d 1 o c o m a i a s h e a dd re s. ~ o f d i e~vext ms{ruc t ion befbre re tu rn in g ~o the s ta :r~ o f the tonp,A d m i t t e d l y , t h is i s n o~ a p r o o f o f a t h e o r e m , b u t ~ h e i d e ai s c e r ta i n l y t he r e , p r o m p t i n g o n e ~o w o n d e r w h e t h e rC

  • 8/6/2019 On Folk Theorems - David Harel

    5/11

    t iexi t f lowch arts . T he or em 3 .1 of [32, p . 441 s ta tes thateve ry such f l owchar t i s equ iva l en t t o one i n t he sub l an-g t ~ a g e a n a l o g o u s t o c o n v e n t i o n a l w h i | e - p r o g r a m s , b u twi th no addi t i on a l va r i ab l e s a t a ll ! In v i ew of t he nega t iveres~t lt s of K nu th and IF/oyd [53] , Ashcrot~ and M an na[2 , 31 , Pe t e r son , Kasami , and Tokura [78] , Inde rmark[47] , Kosaraj t~ I54t, and Kas ai {491, f rom wh ich i t fol low stha t Ib r con ven t iona l f l ow char t s t h is s t a t em ent i s f a ls e ,a c a r e % l r e a d i n g o f g l g o t ' s p r o o f b e c o m e s n e c es s ar y .T h e e v i d e n c e o f t h e f o / k i s h n e ss o f o u r T h e o r e m is c o n -s ide rab ly r e in ik~rced when one d i s cove rs t ha t t h i s p roofi s a l so e s sen t i a l l y t he g loba l one i n d i sgu i s e ! Booleanvar i ab l e s a re c l eve r ly r ep l aced by wha t a re ca l l ed " t r i v i a ls chem es" m [321 , whic h we migh t ca l l "cab l e s , " i n whicho n t y o n e " w i r e " o f e a ch i s c o n n e c t e d . S u c h a c a b l e f o r ce sc o n t r o l t o p r o c e e d t o o n e d e s i g n a t e d b o x i ) r e x e c u t i o nnex t t ime a rou nd the l oop . Som e de t a i l s and an i l lu s t r a -t i o n c a n b e t b u n d i n t h e A p p e n d i x .

    D igging s l i gh t ly deepe r i n to t he ea r l i e r pape r s i na lgebra i c s emant i c s t i ' om which E lgo t ' s pape r [32] ons t r u c t u r e d p r o g r a m m i n g g r e w , o n e d i sc o v e r s s o m e i n t e r-e s t i ng t i~ct s. A n orma l t b rm re su l t fo r c e r t a in k inds o fo p e r a t i o n s o n c e r t a in k i n d s o f u n i n t e r p r e t e d a l g e b r a soccurs i n va r ious pape r s d i f f e r ing qu i t e d ras t i ca l l y f romo n e a n o t h e r i n n o t a t i o n a n d t e r m i n o l o g y . T h u s , i n at973 pap er o f Elgot [31, pp. 213--..222] (pu bl ish ed in 1975)w e f in d a t h e o r e m a b o u t t h e " n o r m a l d e s c r i p t i o n o f am o r p h i s m o v e r a n i t e ra t i v e t h e o r y / ' I n W a n d ' s 1 97 2pape r [85 , p . 335] (pub l i shed in 1973 ) we f i nd a normaltb rm theo rem for " /x -c lones o f ope ra t i ons ove r a l a t ti c ea l g e b r a . " I n a 1 97 8 p a p e r b y T i u r y n [ 83 , p p . 2 1 -2 2 ] w ef i n d a n o r m a l t b r m t h e o r e m f o r " r e g u l a r p o l y n o m i a l sove r r egu la r a lgebras . " F ina l l y , i t was a s ea r ly a s 1969wh en B ekid [9, pp . 12 -151 p rov ed a norma l fo rm th eoremt b r " d e f i n a b l e o p e r a t i o n s i n g e n e r a l a l g e b r a s . "

    Al l t he se four r e su l t s can be shown to g ive use t ov e r s io n s o f o u r t h e o r e m f o r t h e m o r e g e n e r a l c a s e o f" m u l t i w i r e " r e c u r s i v e p r o g r a m s c h e m e s ( a s o p p o s e d t of l o w c h a rt s ). W i t h o u t a t t e m p t i n g t o d e s c r ib e t h e t e c h n i ca ld e t a i ls o f t h e s e p a p e r s , w h i c h a r e a l l fa r b e y o n d t h es c o p e a n d i n t e n t io n o f th i s p a p e r , w e r e m a r k t h a t i n o u rt e rmin ology the p ro ofs i n Bekid [9 ] and E lgo t [31 ] a reloca l and in T iu ry n [831] and W an d [851 g loba l . F ur the r -more , t he p roofs i n [9 , 31 ] s t a r t w i th s chemes which a rea n a l o g o u s t o w h i l e - p r o g r a m s , a n d a l l f o u r p r o o f s u s e .e s sen t i a l l y , t he " t r i v i a l s cheme" mechani sm for mimtck-i n g B o o l e a n v a r i a b l e s. T h e s e o b s e r v a t i o n s m a k e t h e t a s ko f f i t t i n g t h e s e p r o o f s i n t o o u r f r a m e w o r k s o m e w h a teas i e r . Accord ing ly , ou r dec i s ions on the se we re t o c l a s -s i fy Bekid [9] and E lgo t [31 ] a s add i t i ona l p roofs o f t heM i r k o w s k a p a r t [ 70 ] o f t h e lo c a l p r o o l l a n d t o a d d W a n d[85] and T i uw n [831 to t he l i s t o f Co ope r - l i ke g lo ba lp roo t~ . Neve r the l e s s , a s t he a lgebra i c approach i s sod i f f e r e n t f i 'o m t h a t o f m o s t o f t h e o t h e r p r o o f s w e h a v em e n t i o n e d , w e c h o o s e t o a s s i g n p r i o r i t y c r e d i t [ b r t h es e c o n d p a r t o f th e l o c a l p r o o f t o B ek i d a n d M i r k o w s k ai n d e p e n d e n t l y , a l t h o u g h t h e t b r m e r p r e c e d e s t h e l a t t e rby th ree yea r s .

    R e t u r n i n g t o th e g l o b a l p r o o f, t h e l e a r n e d r e a d e r c a nprobab ly s ee now where t he se f i nd ings a re l ead ing ins .T h e s e a r ch f o r o c c u r r en c e s o f t h i s p r o o f i n t h e ( o b v i o u s l yr e l e v an t ) l it e r a tu r e o n s t r u c t u r e d p r o g r a m m i n g a n d f l o w -char t s l ed to Co op e r ' s ope ra t i on a l ve r s ion [22], which , i ntu rn , s e rved to a t t r ac t ou r a t t en t ion to Burks , Golds t i ne ,a n d v o n N e u m a n n [ t8 ]. B u t n o w w e h a v e g r a d u a ll y b ee n.l u r e d i n t o c o n s i d e r i n g t h e o r e m s i n a l g e b r a i c s e m a n t i c s( e .g , 183 , 851] ) and in r ecu r s ive fun c t ion theo ry ( e .g , [16 ,65] ) , which , a t f i r s t s i gh t , s eem qu i t e unre l a t ed t o ourna ive f l owchar t s . And so , t he re . s eems to be no e scapef r o m c o n s i d e r in g t h e g r a n d c o m m o n a n c e s t o r o f a ll s u c hr e s u l t s - - K l e e n e ' s t 9 3 6 n o r m a l I b r m t h e o r e m f o r p ar t ia lr ecur s ive func t ions [5 / ] !

    Indeed, Kteene [51, p . 736] (see a lso Kleene [50, p .288] and Roge rs [82 , pp . 2%30] ) showed tha t eve rypa r t i a l r ecu r s ive func t ion f c an be desc r ibed as t heapp l i ca t i on of a p r imi t i ve r ecur s ive func t ion g t o pk ,whe re h i s p r imi t i ve r ecur s ive and # , t he "min imiza t ion"ope ra tor , ac t s , i n e s sence , l i ke a whi l e l oop . The "body"of t ha t l oop , h , c an be l oose ly desc r ibed as s imula t i ngo n e s t e p m t h e c o m p u t a t i o n o f f u s i n g c o o r d i n a t e s f o rt h e " c u r r e n t v a l u e " o f t h e f u n c t i o n a n d t h e " l a b e l " o fthe nex t s t ep . The func t ion g s imply i so l a t e s t he f i na lv a l u e o f th e c o m p u t a t i o n b y p r o j e c t i n g o n t h e a p p r o p r i -a t e c o o r d i n a t e .

    N ow . K l e e n e ' s t h e o r e m a p p e a r s r e p e a t e d l y m c o u n t -l es s p a p e r s o n r e c u r s iv e f u n c t i o n t h e o r y . H o w e v e r , s i n cewe d id , a f t e r a l l , s t a r t ou t w i th f l owchar t s , and s ince t hel in e m u s t b e d r a w n s o m e w h e r e , w e h a v e d e c i d e d t o d r a wi t r i gh t he re : no a t t empt sha l l be made to s ea rch for a l lo c c u r r e n c e s o f K l e e n e ' s t h e o r e m , a n d t h e o n e s w e h a v eme nt ione d [50 , 82] w i l l no t qua l i fy a s p roo fs o f ou rT h e o r e m .

    T o s u m m a r i z e t h is p a r t o f o u r t a l e. t h e g l ob a l p r o o fh a s b e e n tr a c e d d o w n t w o o r t h o g o n a l p a t h s , e a c h o fw h i c h h a s l e d to a p i o n e e r ~ J , y o n N e u m a n n i n h i s 1 94 6w o r k o n d e s i g n i n g c o m p u t e r s [ 1 8 ] a n d S . C . K l e e n e i nh i s 1936 wo rk in r ecur s ive func t ion theory [51]. Al tho ughCo op e r [22] p rov ided the f i r s t exp l i c it p r oo f o f ou rTheorem as s t a t ed , we fee l i t i s r easonab le t o make them o d e s t a s s u m p t i o n t h a t h e . a s w e l l a s M 1 s u b s e q u e n tp rove rs , was e i t he r d i r ec t l y o r i nd i rec t l y i n f luenced by[181 and [5 l ] . Co nseq uent ly , we as sign c red i t s fo r theg l o b a l p r o o f o f o u r T h e o r e m t o K l e e n e [5 1] a n d B u r k s .G o l d s t in e , a n d y o n N e u m a n n [ 1 8] i n d e p e n d e n t l y . S o , i nf a c t . t h e T h e o r e m was " k n o w n " t o K l e e n e a n d y o nN e u m a n n .Aga in . b lu r r ing c red i t s m the i n te re s t o f enu me ra t iona n d b e g g i n g t h e r e a d e r 's p a r d o n f o r i n s er t in g a n a n n o y -ing s e l f - r e fe rence t o t he p re sen t pape r [401 in which , nod o u b t , t h e p r o o f a p p e a r s a g a i n . ~ w e a s s o c i at e t h e g l o b a lp r o o f o f tl he T h e o r e m w i t h

    ~"This is the "re fem ng m as many of o~te's own papers as possible"syndrc~me, taken to a new extrerae: a reference to the very paper beingread! In the ab~tce of any other no~ab{e c~ntr~butions of the presentpaper, and in view of the amount of work ~hat went into writing it, wecannot resist ~he tempm tkm m clai m priority ~or this first~C~mmunica tmRs July t980of Vo|um e 23the ACM Number 7

  • 8/6/2019 On Folk Theorems - David Harel

    6/11

    ({51] V {18]} A ({65I V [22 ] V [ l i ] V {2] V {17{ v[ 8 71 v {as ] v {52 t v { 1 6 ] 'v [ 6 8 ] v { , > 1 , , ~{38] V {63 ] V [ 32 ] V {20 ] V [ 8 l ] V [ 59 ] Vi s31 v I@t v { @ ] ) .

    A s m e m i o a e d e a r l i e r , s t a t i s t i c s a r e p e r h a p s n o t c r u -cial tbr ~he class i f icat io n of a theo re m as fbtklore., bu~t h e y a r e i m p a s s i v e n ev er ~h eb e ss . T h e v e r s i o n o f t h eT h e o r e m w e h a v e t a l k e d a b o m s o f a r ~ h a s e s s em i a t ty~wo pr(~s. O f ~ h e h > ca l p r o o f w e h a v e & r a n d 4 A 5~>ccurrences {fou r of th e f i rs t pa~% five of the second~n o r i e o f b o t h ) a n d o f t h e g Io b a l p r o o f 2 A 2 0 . W h i l e i t isn o r d e a r w h e t h e r 4 A 5 s h m d d e v a l u a t e ~ o 4 , 5 . 9 . o r 20~~ he re a r e c e r t a in l y m ~ ~o c c u r r e n c e s .

    tn *he process o f exp os ing these f%~cts we have a l so~ bu rid n u m e r o u s r e f e r e n c e s t o t h e 7 h e o ~ m o r i ts B o h ma n d J a c o p i n i p a r t~ w h i c h d o n u t c o m a i a p rri~ xg ~ m a i n l yi n c o n n e c t i o n w i t h t h e i ss u e o f s m ~ a u r e d p r o g r a m m i n gFor a sa mp le o f f i f ty see Arsac {1~ p . 3 I~ Ba ker{4 , p . 991 , Baker and KosarNu {A p~ 555] , Banachowsk i{& p. {1 5] , Baa ach ow sk i e~ a l . {7, p . 22], Bates{8, p . 1%] , Benso n {10, pp~ 145- N6 ] , B lo r im ar id T iad e l l{ i 2 . p . 2 7~ ] , Boehm {13 . p . t 1 3 { , B o h l [ | 4 , p . t40],Ch an dr a {19 , p . 1 ] Coh en an d Lev i {2 l , pp . 26% 225],Cu t ik {26, p. 54], De rm m g {27, p. 10; 28, p. 216]. D~ kst ra{29 , p . 148] , Do nal dso n 1 3 0 ~ p. 531, Engelfr ie~ {34~ p.2 C ~t , F i s c h e r a n d F i s c h e r { 3 5 , p . 4 6 1t, G o o d m a n a n dH e d e m i e m i [ 3 7 p p . I 9 -2 @ , H a r d { 3 9 , p . 89 ], H a r d ,N or vg , R oo d ar id To D l , p . 2 I81 , Hopki r~s {~ , p . 59 I ,Hugbms [45 , p . 591 , Hu ghe s a r id M ich to m { ~, p . 611 ,Jen sen arid T ori ies lath , ppo 228~ 236}, Kasa i {49, p. 1771,K n u t h a n d F Iw d { 5 3 , p . 3 1 ], K o s a r a j u { 5 4 , po 2 5 2I .Leavenwor th [56 , p . 55] , Ledgard and Marcx~tU {57, p.6321, Lee a nd Ch ang {58, p . 65], M ar t in I6 t , p . 51~M c G o w a n I6 2 , p. 25 ], M i I l e r a n d L i r id a m e < x t { ~ , p .561, MiIls {69, p. 901, M ye rs ~71~ p~ t l0 ; 72. p. 5] , N a z ia n d Sh a e i d e r m a r i [ 7 3~ p p . 1 3 - ~4 ] ~ N e e t y { 7 4 , p . 1 2 0] ,NichoHs {75, pp . 4C~9-410f Par t ch {76, p . 12S21 Pe te rson ,Ka sam i , a r id Tok ur a {78, p~ 51 l{, P ra the r {80, pp , t :59 ,

    7 0 f V a n G e | d e r {8 4, p p . 3 , 5 ], W i se , F r i e d m a m Sh a p i r o ,a n d W a n d { 8 6, p . ~ / ] , Y o u r d o n [ g8 , p p . | 4 6 - 1 4 7 ; 8 9 , p107], Yo ~rdor i and Cor i s t ami r~e i 9 0 , p . 6 6 ] , a n d Z d k o w ~i tz . Shaw, and Gannoa ~9I , p . 60! .

    M a a y O f"~h e~ re fe re nces c~on ta in in te res t in g re l e vammater i a l , bu t i r i o rder ~o keep th i s i r ives f igaf ion f%omget{tr ig ou~ of" ha ad we wil t a ot d esc ribe ~hem aN, Let u sj u s t r e m a r k t h a i B o h l {1 4 ] i n f b r m s a s t h a t B o h m a n dJacopin i {~5] w as '~mi~ially p~btb~hed i n I t a l i a n i a 1 % 5 , "~hat Cohera and Lev i {2 ! { ex tend f l~e Th eo re m *o para l l e lprog ram s , a .~d tha t P ray .her [gO[ prov es a s im i la r resuh ~fbr Tuft: r ig m aclhines ,

    O Br s to ry i s g iven a f ina l asd qm~e unexpec tedf r i lk i sh twis t by the e i s l e ri ce o f a sec ond vers i

  • 8/6/2019 On Folk Theorems - David Harel

    7/11

    ~ o c ; d p r c u . ~ f

    {B~,ib,m a ~ d ~ac~, pif~i) {Beki~ / M irk ow ska )

    (K~cf~ / ~B~rk :~ Gcd Js~m e an d yo n Neum ~m S )f l o w c h ~ r t . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . ~ singqe ~hi~e4o

    (Enge{e~ / ( ~ p e r } (A*hc*oti and Ma*m a) {Hir{x~e and O?'a)f l o w c h a r ~ ................................................................ ~bk~& -l 'orm .......................................................................... * ~hil e-p r~ yg ram ~ ................................................. "*s in gl e w h i t ~

    t o t he Theorem or i t s pa r t s , we have found (4 A 5 ) + (2A 2(;)) + (2 A 2 A l ) p r inted occ urre nce s of i t s proof ; '~which e va lua t e s t o 27 , 36 , o r 64 , depen ding , r e spec t ive ly ,u p o n w h e t h e r " A " is i n te r p r et e d a s " m a x " , " + ' , o r" ' . Th ese p roof !s , which span for ty - fo ur yea r s , a l sos p a n t h e c o m p l e t e s p e c t r u m o f r e c o g n i z e d s c i en t if i c li t-e r a tu r e : t e x t b o o k s , m o n o g r a p h s , s u r v e y a r ti c le s , j o u r n a lpape r s , confe rence p roceed ings , news le t t e r s , t he se s , t e ch-nical reports , lec ture notes , le t te rs to edi tors , and se l f -referemial folk ta les~

    Q u i l e a f b l k t h e o r e m , i t s e e m s .

    4 . T h e F u t u r eW e h a v e p o s t u l a t e d th e a p p r o p r i a t e l y a d a p t e d p r o p -

    e r t ie s o f p o p u l a r i ty , a g e , a n d a n o n y m o u s a u t h o r s h i p a sc r i t e r ia fb r de t e r min ing i f a s t a t ement i s a t b lk t heorem,and have i l l u s t r a t ed by exhib i t i ng a t heorem:, t he fo lk i sh-h e s s o f w h i c h s e e m s t o b e b e y o n d d o u b t .

    As l b r t he f f~ tu re , we envi s ion th ree pos s ib l e d i r ec -t i ons fo r fu r the r r e sea rch :( 1 ) C o m p i l i n g a n e n c y c l o p e d i c l is t o f fo l k t h e o r e m s in

    c o m p u t e r s d e n c e .(2 ) Inves t i ga t i ng t he r e l a t ed conce p t s o f f o l k d e fi n it io na n d f i ) l k t e c h n i q u e ( that i s , proof=technique)~(3 ) Sho win g tha t fo lk fac t s such as P # N iP a re fo tk

    theorems~5. Appetldix

    Fi r s t , some de f in i t i ons . A f l o w e h a r t i s a f i n i t e d i r ec t edg r a p h w i th n o d e s l a d l e d e i th e r w i th a n a ss i g n m e n t o fthe t b rm x ~ - f (~ /7 ) fo r va f i aN e x , func t ion sy mb ol t : andvec to r o f va r i ab l e s j~ o r w i th a t e s t which i s a Bo olean-com bina t ion of epre s s ions o f t he fom~ p ( f ) fi:~ r p red i ca t es y m b o l p a n d v e c t o r j~\ A s s i g n m e n t n o d e s h a v e o n e

    w e would greatly app reciate poimer~ te ~ho~se~t~r~ aces of preo~we m ight ha; 'e mitre d ia ou r ignor~nce~ a o ui' haste, or e~herw~se,

    o u t g o i n g e d g e a n d t e st n o d e s h a v e t w o , l a b e l e d 1 a n d 0 .T h e r e i s o n e S T A R T n o d e w i t h n o i n c o m i ng e d g e s a n do n e o u t g o i n g e d g e , a n d a t l e a s t o n e S T O P n o d e w i t h n oo u t g o i n g e d g e s . A n in terpre ta t ion I o f a f l ow char t Fc o n s is t s o f a s et o f d o m a i n s , a n a p p r o p r i a t e a s s o c i at i o no f d o m a i n s w i t h t h e v a ri a b l e s o f F , a n d a n a p p r o p r i a t ea s s o c i a t i o n o f f ~ n c t i o n s a n d p r e d i c a t e s o v e r v a r i o u sc r o s s - p r o d u c t s o f t h e d o m a i n s w i t h t h e f im c t i o n a n dp r e d i c a t e s y m b o l s o f F . G i v e n a n i n t e r p r e t a tm n I a n din i t iM va lues fo r t he va r i ab l e s appea r ing in F , t he way inw h i c h F p r o c e e d s t o c o m p u t e i t s v a l u e s i s s t r a i g h t fo r w a r da n d i s a s s u m e d t o b e k n o w n m t h e r e a d er . D e n o t e b y ' F ~the l unc t ion , a s soc i a t i ng w i th each s e t o f i npu t vMues forF i t s o u t p u t v a l u e s , o r a s p e ci a l " u n d e f i n e d " s y m b o l i f Fdoe s no t t e rm ina t e . A l so , l e t a s h ( F ) a n d t e s t (F) be th es e ts o f a s si g n m e n t s a n d t e st s a p p e a r i n g i n F .

    N e x t , w e d e f i n e a n a p p r o p r i a t e s e t o f w M l e - p r o g r a m s ,re l a t i ve t o s e t s o f a s s ignment s and t e s ts A and T . De f ineWH(A, T) a s t he l eas t s e t such tha t :( 1) A C W H ( A , T )(2 ) i f W~, V~ E W H(A , T) and P E T , then

    ( i) ( W ~ ; W ~ ) E W H ( A , T ) ,(i t) ff P t he n W:1 e l se W~. E W H(A , T) , and

    ( ii i) whi l e P do W~ E W H( A, T ) .Aga in , g iven an app ropr i a t e i n t e rp re t a t i on an d in i ti a lv a l u e s f o r t h e v a r i a b l e s a p p e a r i n g i n a w h i l e - p ro g r a m W ,t h e s t a n d a r d m e t h o d o f d e f in i n g t h e c o m p u t a t i o n o f" Wi s a s s u m e d t o b e k n o w m W e u s e W i s i m i l a @ a s w i t hf l o w c ha r ts . L e t W H d A , T ) b e t h e s et o f t h o s e e l e m e n t so f W H ( A , T ) w h i c h c o n t a i n a t m o s t o n e o c c u r r e n c e o fwMie-do,Now. t o be ab l e t o r i gorous ly s t a t e t he Booleanv e r s i o n o f o u r T h e o r e m . w e le tBasra F) = a sh( F) U { p~ ~- t rue . p~ ~- . r i s e }. I ~ t < w .a n dBte s t ~ t h e s e t o f B o o l e a n c o m b i n a t i o n s o f te s ts m t e s t (F jand e xpre s s ion s of t he t b rm p~?. fo r t ~ i < ~ .C o m m u r f i c a f i ~ n s J u l y ~ 9 80o f V o l t , m e 2 3t h e A C M N u , m b e~ 7

  • 8/6/2019 On Folk Theorems - David Harel

    8/11

    F i g . 2 . C o op e r ' s G l ob a l P roo f .

    r

    / /[ - - t r u e , n 1 )~ [ B - - f a l s e ( n + l ~

    Fig. 3. Elgot's Proof.

    w h e r e p l , p 2 . . . a r e n e w v a r i a b l e s a n d F i s a n a r b i t r a r yf l o w c h a r t . A n i n t e r p r e t a t i o n i s c a ll e d nice i f t h e p i r a n g eo v e r t h e d o m a in ( t ru e , f a lse} a n d t h e t es t p i? is t r u e ( i .e . ,e v a l u a t e s t o 1 ) i f f t h e v a l u e o f p i i s t ru e . D e n o t e t h e s e to f n i c e in t e r p r e ta t i o n s b y N I C E . T h e n t h e B o o l e a n v e r -s i on o f o u r F o l k T h e o r e m s ta te s :(*) ( V F ) ( 3 W E W H , (Basn(F), Btes t(F)))

    ( V I ~ N I C E ) ( F , = W O .38 6

    In o rd er t o i l l u s t r a t e t h e B 6 h m a n d Ja co p in i [1 5 ] AM i r k o w s k a [7 0] " l o c a l " p r o o f , w e p r o v i d e o n e o f t h et r a n s f o r m a t i o n s o f M i r k o w s k a [7 0] :

    w hi l e P l do (W g w hi l e P2 d o W 2)

    "pl ~-- Px" ; pz ~-- fa l se ; whi le (p l V p2) d o ( i f p 2 t h e n W2 e lse W 1; "p2~- e2"; ' , 'pi "~- Pi" ),

    C om mu n i c a t i ons , J u l y 1 9 80o f V o l u m e 2 3t h e A C M N u m b e r 7

  • 8/6/2019 On Folk Theorems - David Harel

    9/11

    w h e r e , e . g o " ' p : ....... " >4and s tb r tf P~ he n p~ ........ tn , ee lse p: . .. .. fa ls e

    (~ .~pe r' :, g loba l p r oo f I 22 ] p roc eed s a/~ tb l lows : ( } ive~a l l o w c h a r l {;~ de no te the axs, gn m e n: r~odes o f F in m : 'nea r b i t r a l T , b : a ~ f i x e d o r d e r b y o ,, 'n . . . . a ; < , a n d t h e t es tnode> s~m da : ' l y by rose , , , . . . . to . re .... Th in k of a l t {heS T O P taxies a~ b~: ing n : m : b e r e d r n + ] . } " o r e a c h I :~; a5 n te~ ne.~(i) b e sh e ~ : : b s c r i p : c o r : ' e s p o n d i n g S o t h en o d e a d j a c e r u S o a x < ( b y it5 o u t g o i n g e d g e ) a n d f 'o r e a c h~ + t ~:: i ~ m l et w ue( i) a n d / } d . ~ e ( i ) be she ~ubscrip:~sc o r r e G ~ o n d i n g ~ o {he node :~ , ad jac en t S o t o . < ( b y t h e i a n d0 ou tg o in g edg es , r e spec t iv e ly ) . L e t i~ be ~he s : .~v ;c rip tcor re sp ,. ,r} d i ::g :o the no de a ac'hC: r Pabh cat,on& Wz~awo Pv/[a:a& {9772L_a~}& {{a:{es~L1 ~ h ,g ;c fo r ~ :onwcl p r oW am ievek~pmen~. P h D {h .. .Cornet1 um v.. ~ag ~:4799, B.ek~.H De fiaa Ne aWvta~i~m~m geee~a~ aAcge;bt~ End ~l~eI~ t 4 t ~ ~e+OS~I{}, gvm~O~. J P . S~r~ac .Ba:: ed p ro S; s t a in i ng t eghm~a~e~. Pr~ z [E .EESy ru p oa ( .;~'e@gf_ :5

  • 8/6/2019 On Folk Theorems - David Harel

    10/11

    18. Burks , A.W., Golds t ine, H.H., and v on Neu mann, J . Prel iminarydiscussion of the logical design of an elect ronic comput inginstrume nt, 1946. In J. yon Neum ann , Co l l ec t ed Works , Vol. V, A.H.Tau b, Ed., MacM illan, New Yo rk, 1963, pp. 34-79.19 . Chandra, A.K. D egrees of t rans latabil i ty and canonical forms inprogram schemas . Proc. 6 th ACM (SIG AC T) Syrup, on Theory ofCom ptng., 1974, pp. 1-12.20. Clark, K ., and C owell, D. P r o g r a m s , M a c h i n e s. a n d C o m p u t a t io n s :A n I n tr o d u c t io n t o t h e T h e o r y o f C o m p u t i n g . McGr aw- Hi l l , NewYork, 1976.21. Cohen, A.T., and Levi, L.S. Structured flowcharts formultiprocessiug. C o m p t r . L a n g u a g e s 3, 4 (1978), 209-226.2 2 . Cooper , D.C. B6hm and Jacop ini ' s reduct ion of f low char ts .C o m m . A C M 1 0, 8 (Aug. 1967), 463,473.23 . Cooper , D.C. Programs for mechanical program ver if ication.M ach ine In t e l l . 6, Edin burg h Univ . Press, 1971, pp. 43-59.24. Culik, K. Structured algorithms and structured program ming .Rep . CS-79-40, Dept. ofC om ptr . Sci., Penn. State Univ., Aug. 1979.25. Culik, K. Entry strong compon ents and their applications (incom puter science). Rep. T R N ov. 79-01, Dept . of Comptr . Sci .,Wayne State Univ. , Nov. 1979.26. Culik, K. Wha t is a flowchart loop and ab out structuredprogramming. S I G P L A N N o tic es ( A C M ) 15 , 1 (Jan. 1980), 45-57.27 . Denning, P .J . Comm ents on mathem at ical overki ll . S I G P L A NN o t i c e s ( A C M ) 10 , 9 (Sept. 1975), 10-11.28. Den ning, P.J. Tw o misconceptions ab out structuredprogra mm ing. Proc. An n. ACM Conf., Minneapolis, Minn., Oct.1975, pp. 214-215.29. Dijkstra, E,W. Go to statemen t considere d harm ful. C o m m .A C M 11, 3 (March 1968), 147-148.30. D onaldson, J.R. Structu red program ming. Datamat ion 19, 12(De c. 1973), 52-54.31. Elgot , C.C. Monodic comp utat ion and i terat ive algebraictheories. In Log ic Co l loqu ium '73 , North-Hol land Pub. Co.,Amsterdam , 1975, pp. 175-230.32. Elgot , C.C. Structured program ming with and without go tostatements. I E E E T r a n s . S o ft w a re E n g . S E - 2 , 1 (Ma rch 1976), 41-54.33 . Engeler , E. St ructure and me aning of elemen tary programs. Proc.Syrup. Semant ics of A lgor i thmic Languages , L e c t u r e N o t e s in M a t h . ,Vol. 188, Springer-Verlag, New Y ork, 1971, pp. 89-101.34. Engelfriet, J. S i m p l e P r o g r a m Sc h e m e s a n d b ~ r m a l L a n g u a ge s .Lec ture No tes i n Comptr . Sc i . , Vol. 20, Springer-Verlag, New Y ork,1974.35. Fischer, B., and Fischer, H . S t r u ct u r e d P r o g r a m m i n g i n P L / I a n dP L / C . Marcel Dekker, Inc., New York and Basel, 1976.36. Go ldschlag er, L.M. Synchron ous parallel com putation. Ph.D. th.,TR- 114, Univ. of Toronto, Dec. 1977.37 . Goodm an, S.E ., and Hedetniemi, S.T. In t roduct ion to t he Des igna n d A n a l y s is o f A l g o r it h m s . McGraw-H il l , New York, 1977.38. Greibach, S.A. T h e o r y o f P r o g r a m S t r u c tu r e s : Sc h e m e s ,Sema n t i cs , Ver i f i ca t ion . Lec ture N o tes in Comptr . Sc i . , Vol. 36,Springer-Verlag, Ne w York, 1975.39. Harel, D. An d/ or programs: A new appro ach to structuredprogramming. Proc. IEEE Specifications for Reliable Software Conf.,Cam bridge , Mass., April 1979, pp. 80-90.40. Harel, D. On folk theorems. C o m m. A C M 2 3, 7 (July 1980).41. Harel, D., Norvig, P., Rood, J., and To, T. A universa lflowcharter. In Proc. A I A A / I E E E / A C M / N A S A Comptrs . inAer ospac e Conf. II, Los Angeles, Calif ., Oct. 1979, pp.218-224.42. Hirose, K., and Oy a, M. Som e results in general theory of flowchar ts . Proc. of the Firs t USA -Japan Com ptr . Conf ., Sponsored byAF IPS , Tokyo, Japan, Oct . 1972, pp. 367-37l .43. Hirose, K., and O ya, M. Gene ral theor y of flow charts. C o m m e n t .Math . Un iv . S t . Pau l i , XXI-2 (1972), 55-71.44. Hopk ins, M.E. A case for goto. S I G P L A N N o t ic e s (ACM) 7, 11(No v. 1972), 59-62; Proc. AC M Ann. Conf., Boston, 1972.45. Hughes, J.K. P L / I S t r u c tu r e d P ro g r a m m i n g . J ohn W i l ey andSons , New York, 1973.46. Hughes, J.K., and Michtom, J.I. A St ruc tured Approach toP r o g r a m m i n g . Prentice-Hall, Englewood Cliffs, N.J., 1977.47 . Indermark, K . On a class of schemat ic languages . Technical rep.82, Inst. for Res. and Programming, Gesellschaft fur Mathematik undDatenverarbei tung mbH, Bonn, Germany, Nov. I974.48. Jensen, R.W., and T onics , C.C; So f tware Eng ineer ing . Prent ice-Hail, Engelwood Cliffs, N.J., 1979.49. Kasai, T. Tran slatab ility of flowcharts in to while programs. Z o fCom ptr . and Sys t . Sc i ences 9, 2 (Oct. 1974), 177-195.3 8 8

    50. K leene, S.C. In t roduct ion to Metamathemat i cs . Van NostrandCo., New York, 1952.51. K leene, S.C. Gen eral recursive function s of natural num bers.Math . Anna len 112 (1936), 727-742.52. Knuth, D.E. S t ructured programm ing with go to statements .C o m p t n g . Su r v . 6, 4 (Dec. 1974), 261-301.53 . Knuth, D.E., and Floyd, R.W. Notes on avoiding "go to"statements. In form. Process ing Le t ter s ' 1, (t971), 23- 3 i.54. K osaraju, S .R. Analysis of structured programs. Z o f C o m p t r .and Sys t . Sc i ences 9 , (1974), 232-255.55. Kreczmar , A. Effect ivi ty problems o f algor i thmic logic. In A n n a l .Soc . M ath . Po l . Ser i es IV ," b )mdam en ta ln format i cae l, 1 (1977), 19-32.56. Leav enw orth, B.M. Progra mm ing with(out) th e goto. S I G P L A NNot i ces (AC M) 7, 11 (No v. 1972), 54-58; Proc. AC M A nn. Con f.,Boston, 1972.57. Ledgard, H.F ., and Marcotty, M. A genea logy of contro lstructures. C o m m . A C M 1 8, 11 (Nov. 1975), 629-639.58. Lee, R.C,T., and Chang, S,K. S tructured programming andautomat ic program synthesis . S I G P L A N N o tic es (ACM) 9 , 4 (Apr i l1974), 60-70; Proc. Syrup. on V ery High Level Languages, SantaMonica, Cal i f . , March 1974.59 . Linger , R.C., and Mil ls , H.D. On the deve lopment of largereliable programs. In C u r r e n t T r e n d s i n P r o g ra m m i n g M e t h o d o l o g y ,Vol. 1, R.T. Yeh, Ed., Prentice-Hall, Englewood, Cliffs, N.J., 1977,pp. 120-139.60. Linger, R.C., Mills, H.D., and Witt, B.I. St ruc tured Programming ."T h e o r y a n d P r a c t i c e . Addison-Wesley, Read ing, Mass., 1979.61. Martin , J.J. The "na tura l" set of basic control structures.S I G P L A N N o tic es (A CM ) 8, 12 (Dec. 1973), 5-14.62. M cGow an, C. St ructured programming: A review of somepractical concepts. C o m p u t e r 8, 6 (1975) 25-30.63. McGowan, C.L., and Kelly, J,R. T o p - D o w n S t r u ct u r e dP r o g r a m m i n g T e c h n i q u e s . Petrocel l i /Char ter , New York, 1975.64. Mer ton, R.K. On the Shou lders o f Gian t s : A Shandea n Pos t scr ip t .Harcour t , Brace and W orld, New York, 1965.65. Meyer, A .R., and Ri tchie, D.M. The com plexi ty of loopprograms. IB M Res. Rep. RC-1817, 1966.66. Miller, E.F., Jr., and Lindam ood, G.E. Stru ctured programming:Top- down appr oach. Datamat ion 19, 12 (Dec. 1973), 55-57.67. Mills, H.D. M athem atical foundatio ns for structuredprogramming. IBM rep. FS C 72-6012, Fed. Sys t . Div., Gai thersburg,Md., 1972.68. Mil ls , H.D. Th e new m ath of computer programming. C o m m .A C M 1 8 , 1 (Jan. 1975), 43-48.69. Mills, H.D. How to write correct programs and know it. Proc.IEE E Tutor ial on Structured Programming, W ashington, D.C., Sept .1975, pp. 84-91.70. M irkowska, G. Alg orithm ic logic and its applications. Do ctora ldiss., Un iv. of Warsaw, 1972 (In Polish).71. Myers, G.J. Rel iab le So f tware th rough Compos i t e Des ign . V anNostrand Reinhold Co., New York, 1975.72. Myers, G.J. Compos i t e~St ruc tured Des ign . V an N os t randReinho ld Co., New York, 1978.73 . N ass i , I . , and S hneiderman, B. Flowch ar t techniques fors t ructured programming. S I G P L A N N o t i c e s (ACM) 8, 8 (Aug. 1973),12-26.74. Neely, P .M. O n program control s tructure. Proc. Ann. AC MConf., Atlan ta, Ga., 1973, pp. 119-125.75. N icholls, J .E. T h e S t r u c t u re a n d D e s i g n o f P r o g r a m m i n gL a n g u a g e s . Addison-Wesley, Reading, Mass., 1975.76. Par tch, B. Improved technology for appl icat ion developmen tmanagement overview. Proc. SHARE XLI, Miami, F lor ida, Aug.1973, pp . 1281-1300.77 . Perkowska, E . Theore m on the norm al form of a program. Bul l .Acad . Po l . Sc i ., Ser . Sc i . Math . A s t r . Phy s . 22 , 4 (1974), 439-442.78. Peterson, W.W., Kasami, T., and Tokura, N. On the capabilitiesof while, repeat, a nd exit statements. C o m m . A C M 1 6, 8 (Aug. 1973),503-512.79 . P lum, T. W-S. Mathem at ical overki l l and the s t ructure theorem.S I G P L A N N o tic es ( A C M ) 10 , 2 (Feb. 1975), 32-33.80. Prather, R.E. Structured Turing machines. In form. and Con t ro l3 5 (1977), 159-171.81. Pratt, V.R. Sema ntica l considerations o n Floyd -Ho are logic.Proe. 1 7th Syrup. on Found ations o f Comptr. Sci., Houston, Texas,Oct. 197 6, pp. 109-129.82. Rogers, H., Jr . Theory o f Reeurs i ve Funct ions and E f f ec t i veComputab i l i t y . McGraw-Hil l , New York, 1967.Comm unicat ions July 1980of V olume 23t h e A C M N u m b e r 7

  • 8/6/2019 On Folk Theorems - David Harel

    11/11

    KL { i~ p ~ ] fa~e d poiv~s a t@ a~gebr;~, w~*,h mih~im ly kingi~> N ( r ~ p{ * g li am : lP ~ b C o ~ A m ~ e ~ d a m , ~ 9 7 ? p p 3 31 3 4 1g~ W ~: /. :. { ) S , F m q ~ a r ~ i ) P Sha?~rc ,, S< , a nd W a n d , Mg o , ~ e a ~ > v 0 l u e d k x p ::~:: 'tS V ~ 7 5 L 4 3 1 4 5 i87. W~ A~ W A A Ca~< aga~ns~ @ p>~,:~ S I ( ] P I A N N o g i c e ~ '{ A ( M } 7 o1 / {N ov 1~)7 2 ),61 M< } > f> < A C M A w< C o n f ; B o s e { m , !972~gag. Y~ urd l / n whe re n i s an a rb i t r a ry i n t ege r . Thus i f s ksgrea t e r t han uN ty , va r i a t e s w i th a t e s s t han un i ty canb e s a m # e d . T h e c a s e s n = 2 a n d n = 4 a r e c o n s i d e r e dexp l i c i t l y aeM a re shown to r e t a in t he f eaVares o fc o m p a c t n e s s , e a s e ~ f a n d u ~ f f o rm s D ee d .

    K e y W o r d s a ud P h r a ~ g a m m a v ar ia te s~ r m n ~n u m b e r s , s i m u l a t io n

    C R C ategories: 5~5, 8 , t1 , In t roduc t ion

    S i n c e t h e p u b l i c a t i o n o f t h e r e v i e w p a p e r o f A ~ k i.n so na n d P e a r c e {2 ], t h e r e h a v e a p p e a r e d a l a rg e n u m b e r o fg a m m a v a r i a t e g e n e r a t o r s c o v e r i n g t h e c a s e ~ > I w h e r e~ i s t h e s h a p e p a r a m e t e r . O n e o f t h e m o r e n o t e w o r t h ym e t h o d s is b a s e d o n t h e g e n e r a t t e c h n i q u e o f g e n e r a t i n gran do m var ia~es us ing the r a t io o f un i fo rm v a r i a t e sp r o p o s e d o ri g in a l ly b y K i n d e r m a a a n d M o n a h a n { 6].K i n d e r m a n a n d M o n a . b a n [7 ] a n d C h e n g a n d F e a s t [5 ];have sugges t ed Mgor i thms us ing th i s t e chnique t o gen-e ra t e gam ma va r i a t e s, Th e ~brme~ pap e r a l so com ainss o m e s o u n d c r i te r i a f o r t h e c h o i c e o f a n o p t i m a 1 a lg {~

    P e m ~ i < ' m h'~ c o p y w th o~ t~ f ee a ] ~ p ~ i ~gr a ~ te~ p~x~v ided tha t ~ .he c , p i es a r e n o t m a d e o r d~ t r /ba ~e ~ &~ dh 'e~

    ~ N U ~ UK ~

    Cornm~m~c~mB~s hd ) igN)