ebook img

TOWARDS A MEANING OF LIFE? - Hassan Aït-Kaci PDF

40 Pages·2001·2.97 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview TOWARDS A MEANING OF LIFE? - Hassan Aït-Kaci

.J LOGIC GNIMMARGORP 1993:16:195-234 195 TOWARDS A GNINAEM LIFE? NASSAH AiT-KACI AND ANDREAS IKSLEDOP D EFIL is an latnemirepxe gnimmargorp egaugnal gnisoporp ot etargetni eerht lanogohtro gnimmargorp paradigms nevorp lufesu rof cilobmys -moc .noitatup morF eht s’remmargorp ,tniopdnats ti yam eb deviecrep as a egaugnal taking retfa cigol ,gnimmargorp lanoitcnuf ,gnimmargorp and detneiro-tcejbo .gnimmargorp morF a lamrof ,evitcepsrep ti yam eb nees as an ecnatsni ro( ,rehtar a noitisopmoc fo eerht )secnatsni fo a tniartsnoC cigoL gnimmargorP emehcs eud ot dlefhjiH and aklomS gninifer that fo raffaJ and .zessaL eW start htiw an lamrofni weivrevo gnitartsnomed EFIL as a -margorp gnim ,egaugnal gnitartsulli woh its sevitimirp reffo rehtar unusual, and spahrep )yltnasaelp( ,gniltrats .secneinevnoc ehT dnoces trap is a lamrof tnuocca fo s’EFIL tcejbo noitacifinu nees as gnivlos-tniartsnoc revo cificeps .sniamod eW dliub no krow yb aklomS and sdnuoR ot poleved -oeht-epyt ,citer ,lacigol and ciarbegla snoitidner fo a suluclac fo detros-redro erutaef a .snoitamixorppa . . . the tsom tcniccus and citeop :noitinifed ‘Crber, c’est unir’ (‘To etaerc is ot .)’yfinu sihT is a elpicnirp that tsum evah neeb at work morf the yrev gninnigeb of .efil DARNOK ,ZNEROL Die Riickseite des Spiegeki 1. NOITCUDORTNI sA na ,mynorca ’EFIL‘ snaem ,cigoL ,ecnatirehnI ,snoitcnuF and .snoitauqE EFIL osla setangised an latnemirepxe gnimmargorp egaugnal dengised retfa eseht ruof stpecerp rof gniyficeps serutcurts and .snoitatupmoc As rof what EFIL snaem as a sihT‘ elcitra si a noisiver fo [9]. A trohs mrof fo [9] saw osla dehsilbup sa .]ol[ Address correspondence to .rD .H ,icaK-ti’A latigiD tnempiuqE ,noitaroproC hcraeseR -arobaL ,yrot 85 eunevA rotciV ,oguH 92563 nosiamlaM-lieuR ,xedeC .ecnarF :liamE Ihak, .moc.ced.lrp@)iksledop devieceR rebmeceD 1991; detpecca hcraM 1993. THE JOURNAL OF LOGIC PROGRAMMING reiveslEO ecneicS gnihsilbuP ,.oC ,.cnI 1993 655 eunevA fo eht ,saciremA weN ,kroY NY 10010 0743-1066/93/$6.00 196 .H ICAK-Tit DNA .A IKSLEDOP gnimmargorp ,egaugnal ti is eht esoprup fo this tnemucod ot etaitini eht -atneserp noit fo a etelpmoc lamrof scitnames rof .EFIL eW shall deecorp yb gniziretcarahc EFIL as a cificeps noitaitnatsni fo a tniartsnoC cigoL gnimmargorP )PLC( emehcs htiw a ralucitrap tniartsnoc .egaugnal nI its tsom evitimirp ,mrof this tniartsnoc egaugnal setutitsnoc a cigol fo drocer serutcurts that ew shall llac detroS-redrO erutaeF ,ro-cigol erom ,ylesicnoc FSO .cigol nI this ,tnemucod ew naem ot od owt things: ,tsrif ew weivrevo yllamrofni eht ytilanoitcnuf fo EFIL and eht secneinevnoc that ti sreffo rof ;gnimmargorp ,neht ew poleved eht yratnemele lamrof snoitadnuof fo FSO .cigol eW shall llac this FSO .cigol ,hguohtlA ni eht cisab mrof that ew evig ,ereh eht %SO msilamrof basic seod ton tnuocca rof all deweivrevo stcepsa fo EFIL ,.g.e( lanoitcnuf ,noitcuder deniartsnoc tros ,)erutangis ti setutitsnoc eht lenrek ot eb dednetxe nehw ew address esoht erom etarobale issues retal .erehwesle gniwohS woh cisab FSO cigol stif as an tnemugra tniartsnoc egaugnal fo a PLC emehcs is erofereht a lufesu and yrassecen .esicrexe ehT PLC emehcs that ew shall esu has neeb desoporp yb dlefhiiH and aklomS ]51[ and is a noitazilareneg fo that eud ot raffaJ and zessaL .]61[ eW shall enifed a class fo snoitaterpretni fo noitamixorppa serutcurts etauqeda ot tneserper cisab EFIL .stcejbo eW llac eseht FSO .snoitaterpretni As rof ,xatnys ew shall ebircsed eerht tnairav )redro-tsrif( :smsilamrof )1( a citeroeht-epyt mret ,egaugnal )2( an ciarbegla ,egaugnal and, )3( a lacigol )lasualc( .egaugnal llA eerht lliw timda scitnames revo FSO snoitaterpretni .serutcurts eW shall ekam ylsuorogir ticilpxe eht lautum citcatnys and citnames ecnelaviuqe fo eht eerht .snoitatneserper sihT swolla us ot dehs emos thgil ,no and ,elicnocer eerht nommoc snoitaterpretni fo elpitlum ecnatirehni as, ,ylevitcepser )1( tes ;noisulcni as )2( ciarbegla -romodne phism; and, )3( as lacigol .noitacilpmi ruO hcaorppa sretnec dnuora eht noiton fo an .arbegla-FSO sihT noiton was ydaerla desu ylticilpmi ni ,l[ 21 ot evig a scitnames ot .smret-$ treG s’aklomS krow no erutaeF cigoL ,81[ 191 edam eht msilamrof egreme erom ,ylticilpxe yllaicepse ni eht mrof fo a lacinonac“ hparg-FSO ”,arbegla and was desu yb errGD and sdnuoR ni tnecer krow gniwohs ytilibadicednu fo noitacifinuimes fo cilcyc serutcurts ’.]41[ sihT tnemucod is dezinagro as .swollof eW tsrif evig an lamrofni ruot fo emos fo s’EFIL unusual gnimmargorp .secneinevnoc eW epoh yb this ot etartsulli rof eht redaer that emos lanigiro ytilanoitcnuf is elbaliava ot a EFIL .resu eW od this yb yaw fo small tey )yltnasaelp( gniltrats .selpmaxe gniwolloF that, ni noitceS 3, ew deecorp htiw eht lamrof tnuocca fo cisab FSO .cigol ,erehT FSO snoitaterpretni era decudortni rehtegot htiw citcatnys smrof fo ,smret ,sesualc and graphs taking rieht gninaem ni esoht .snoitaterpretni tI is neht edam ticilpxe woh eseht suoirav smrof era detaler hguorht lautum citcatnys and citnames .secnednopserroc nI noitceS 3.4, ew wohs woh ot eit cisab FSO cigol otni a PLC .emehcs roF( eht ekas fo making this krow ,deniatnoc-fles ew ylfeirb ,ezirammus ni xidneppA A, eht ecnesse fo eht lareneg tniartsnoC cigoL gnimmargorP emehcs that ew esu * errGD dna sdnuoR od ton redisnoc detros-redro shparg dna sucof ylno no ,serutaef saerehw aklomS sredisnoc htob eht detros-redro dna eht detrosnu .esac ,revewoH aklomS seod ton ekam ticilpxe eht mutual citcatnys dna citnames sgnippam neewteb eht ,ciarbegla ,lacigol dna citeroeht-epyt .sweiv nO eht rehto ,dnah eht scigol deredisnoc ni [18, 191 era rehcir naht eht cisab msilamrof ot hcihw ew timil sevlesruo ,ereh gniwolla ticilpxe noitagen dna .noitacifitnauq Naturally, all eseht snoisnetxe nac sa llew eb deredisnoc ni our .krowemarf TOWARDS A MEANING OF LIFE 197 .ylticilpxe tI is eud ot dlefhjiH and aklomS ).]51[ ,yllaniF ew edulcnoc gnitapicitna no eht yrassecen snoisnetxe fo cisab FSO cigol ot eveihca a lluf gninaem fo .EFIL 2. LIFE, yllamrofnI EFIL is a .ytinirt ehT detneiro-noitcnuf tnenopmoc fo EFIL is yltcerid devired morf lanoitcnuf gnimmargorp languages htiw redro-rehgih snoitcnuf as ssalc-tsrif ,stcejbo data ,srotcurtsnoc and ciarbegla gnihctam-nrettap rof .gnissap-retemarap ehT ecneinevnoc dereffo yb this elyts fo gnimmargorp is eno ni hcihw snoisserpxe fo yna redro era ssalc-tsrif stcejbo and noitatupmoc is .etanimreted ehT -noitaler detneiro tnenopmoc fo EFIL is yllaitnesse eno deripsni yb eht golorP egaugnal ,31[ 171. noitacifinU fo redro-tsrif snrettap desu as eht gnissap-tnemugra noitarepo turns tuo ot eb eht yek fo a etiuq euqinu and otrehtih unusual generative roivaheb fo ,smargorp hcihw nac tcurtsnoc missing noitamrofni as dedeen ot etadommocca .sseccus ,yllaniF eht tsom lanigiro trap fo EFIL is eht detneiro-erutcurts -opmoc tnen hcihw stsisnoc fo a suluclac fo epyt eht-serutcurts suluclac-$ ,l[ dna--12 stnuocca rof emos fo eht )elpitlum( ecnatirehni ecneinevnoc yllacipyt dnuof ni dellac-os detneiro-tcejbo languages. rednU eseht ,snoitaredisnoc a larutan gnimoc ot EFIL has detsisnoc ni tsrif gniyduts esiwriap snoitanibmoc fo hcae fo eseht eerht lanoitarepo .sloot -rohpateM ,yllaci this snaem gnizilaer segde fo a elgnairt ees( erugiF )1 erehw hcae xetrev is emos laitnesse lanoitarepo noitidner fo eht etairporppa .suluclac NIGOL is ylpmis golorP erehw redro-tsrif rotcurtsnoc smret evah neeb decalper yb ,smret-e htiw epyt snoitinifed .]5[ Its lanoitarepo scitnames is eht etaidemmi noitatpada fo that fo s’golorP DLS .noituloser eL nuF ,6[ 71 is golorP erehw noitacifinu yam ecuder lanoitcnuf snoisserpxe otni rotcurtsnoc mrof gnidrocca ot snoitcnuf denifed yb detneiro-nrettap lanoitcnuf .snoitacificeps ,yllaniF LOOF is ylpmis a -nrettap detneiro lanoitcnuf egaugnal erehw redro-tsrif rotcurtsnoc smret evah neeb -er decalp yb ,smret@ htiw epyt .snoitinifed EFIL is eht noitisopmoc fo eht eerht htiw eht lanoitidda ytilibapac fo gniyficeps yrartibra lanoitcnuf and lanoitaler -noc straints no stcejbo gnieb .denifed ehT txen noitcesbus sevig a yrev feirb and lamrofni tnuocca fo eht suluclac fo epyt ecnatirehni desu ni EFIL .)suluclac-#( ehT redaer is assumed railimaf htiw lanoitcnuf gnimmargorp and cigol .gnimmargorp ERUGIF 1. ehT EFIL .elucelom snoitcnuF snoitaleR 198 H. AiT-KACI AND A. PODELSKI 2.1. qKalculus nI this ,noitces ew evig an lamrofni tub evitamrofni noitcudortni fo eht ,noitaton ,snoitarepo and ygolonimret fo eht data serutcurts fo .EFIL tI is yrassecen ot dnatsrednu eht gnimmargorp selpmaxe ot .wollof ehT suluclac-@ stsisnoc fo a xatnys fo derutcurts sepyt dellac smret-@ rehtegot htiw gnipytbus and epyt noitcesretni .snoitarepo ,ylevitiutnI as dednuopxe ni ,15[ eht suluclac-@ is a ecneinevnoc rof gnitneserper ekil-drocer data serutcurts ni cigol and lanoitcnuf gnimmargorp erom yletauqeda than redro-tsrif smret ,od tuohtiw ssol fo eht detaicerppa-llew noitaitnatsni gniredro and noitacifinu .noitarepo teL us ekat an elpmaxe ot .etartsulli teL us yas that eno has ni dnim ot sserpxe yllacitcatnys a epyt erutcurts rof a person htiw eht ,ytreporp as desserpxe rof eht denilrednu lobmys ni erugiF 2, that a niatrec lanoitcnuf margaid .setummoc ehT xatnys fo smret-$ is eno ylpmis deroliat ot sserpxe as a mret this dnik fo etamixorppa .noitpircsed ,suhT ni eht ,suluclac-$ eht noitamrofni fo erugiF 2 is ylsuougibmanu dedocne otni a ,alumrof ylsuoucipsrep desserpxe as eht :mret-$ X : person(name - id@rst * string, last - S : ,)gnirts spouse * personhame * tsal(di * 9, spouse = .))X tI is tnatropmi ot distinguish gnoma eht eerht kinds fo slobmys gnitapicitrap ni a .mret-# eW assume nevig a tes ’3 fo stros ro type constructor symbols, a tes 9 fo spouse ERUGIF 2. A evitatummoc lanoitcnuf .margaid SDRAWOT A GNINAEM FO EFIL 199 ,slobmys and a tes /I fo ro( nI eht features, or attributes variables coreference tags). mret-+ ,evoba rof ,elpmaxe eht slobmys era drawn morf 9, eht person, id, string slobmys morf 9, and eht slobmys X, S morf .’L eW( name, first, fast, spouse ezilatipac ,selbairav as ni ).golorP A mret-+ is rehtie ro A deggat mret-$ is rehtie a elbairav ni /I tagged untagged. ro an noisserpxe fo eht mrof X : t erehw X E v is dellac eht s’mret root variable and t is an deggatnu .mret-$ An deggatnu mret-$ is rehtie atomic ro attributed. An cimota mret-G is a tros lobmys ni Y. An detubirtta mret-@ is an noisserpxe fo eht mrof s</, =. ,,t . . . , nL * t,) erehw eht toor s’elbairav tros lobmys s ~9’ and is dellac eht s’mret-@ ,epyt eht s’if era yllautum tcnitsid etubirtta slobmys principal ni Y, and eht era smret-$ .)0 ti’s (n 2 selbairaV erutpac ecnereferoc ni a esicerp .esnes yehT era ecnereferoc tags and yam eb deweiv as depyt selbairav erehw eht epyt snoisserpxe era deggatnu .smret-$ ,ecneH as a noitidnoc ot eb a mret-$ must evah all secnerrucco fo well-fotmed, hcae ecnereferoc tag yltnetsisnoc refer ot eht emas .erutcurts roF ,elpmaxe eht elbairav X ni person(id =z.n ame(first * string, last * X : string), father * personcid 3 name(last = X : string>>) srefer yltnetsisnoc ot eht cimota mret-Q oT yfilpmis srettam and diova string. ,ycnadnuder ew shall yebo a elpmis noitnevnoc fo gniyficeps eht tros fo a elbairav at tsom ecno and dnatsrednu that rehto secnerrucco era yllauqe gnirrefer ot eht emas ,erutcurts as :ni person(id * name(first j string, last * X : string), father * person( id * name(Zast * X))). nI ,tcaf ecnis ereht yam eb ralucric secnerefer as ni X: person(spouse =j this noitnevnoc is .yrassecen ,yllaniF a elbairav gniraeppa person(spouse a X>>, erehwon ,depyt as ni is ylticilpmi depyt yb a laiceps tsetaerg laitini junk(kind ax) tros lobmys syawla tneserp ni 9. sihT lobmys lliw eb tfel elbisivni and ton T nettirw ylticilpxe as ni ro nettirw as eht lobmys @ as (age * integer, name =S string), ni nI eht ,leuqes yb mret-+ ew shall syawla naem @(age =S integer, name a string). demrof-llew mret-@ and llac hcus a mrof a ($)-normal form. gnizilareneG redro-tsrif ’,smret smret-r(I era deredro up ot elbairav .gnimaner neviG that eht tes 9 is deredro-yllaitrap htiw( a tsetaerg tnemele its laitrap T), gniredro is dednetxe ot eht tes fo detubirtta .smret-e ,yllamrofnI a mret-+ ,t is subsumed yb a mret-$ ,t fi )1( eht lapicnirp epyt fo ,t is a epytbus ni 9 fo eht lapicnirp epyt fo ;,t )2( all setubirtta fo ,t era osla setubirtta fo ,t htiw smret-e hcihw subsume rieht seugolomoh ni ;,t and, )3( all ecnereferoc stniartsnoc gnidnib ni ,t must osla eb gnidnib ni .,t nI‘ ,tcaf fi a redro-tsrif mret si nettirw t(f 1,. . . , t,), ti si gnihton rehto naht citcatnys ragus rof eht mret-$ .),t,=n,...,,t*l(f 200 H. ICAK-TfA DNA .A PODELSKI roF ,elpmaxe fi and ni 9 neht eht :mret-e student <person paris < cityname student(id * name@rst * string, last * X : string), lives-at * Y : address(city -Paris), father * person(id * name(last *XI, lives-at = Y 1) is subsumed yb eht :mret-+ person(id + name(last * X : string), lives-at * address(city * cityname), father +. person(id * name(last =X)1). nI ,tcaf fi eht tes 9 is hcus that )s’BLG( tsixe rof yna riap greatest lower bounds fo epyt ,slobmys neht eht noitpmusbus gniredro no mret-+ is osla hcus that s’BLG .tsixe eeS( xidneppA B rof eht esac nehw s’BLG era ton ).euqinu hcuS era denifed as eht fo owt .smret-@ A deliated noitacifinu mhtirogla rof smret-$ is unification nevig ni .15[ redisnoC rof elpmaxe eht tesop deyalpsid ni erugiF 3 and eht owt :smret-e X : student(advisor = faculty(secretaly = Y : staff, assistant =3X), roommate 3 employee(representative * Y)) ERUGIF 3. A rewol ecittal-imes fo .stros SDRAWOT A GNINAEM FO EFIL 102 and: employee(advisor * f Jsecretaty * employee, assistant - U : person), roommate - V: studentcrepresentative * V), helper - w,(spouse * U)). riehT noitacifinu pu( ot tag )gnimaner sdleiy eht :mret W : work.study(advisor - f I(secretaty * Z : workstudy(representative * Z), assistant * WI, roommate = Z, helper * w,(spouse 3 WI). tsaL ni this feirb noitcudortni ot eht ,suluclac-+/t ew nialpxe epyt .snoitinifed ehT tpecnoc is suogolana ot what a labolg erots fo tnatsnoc snoitinifed is ni a lacitcarp lanoitcnuf gnimmargorp egaugnal desab no .suluclac-h ehT aedi is that sepyt ni eht erutangis yam eb deificeps ot evah setubirtta ni noitidda ot gnieb .deredro-yllaitrap ecnatirehnI fo setubirtta morf all sepytrepus ot a epytbus is enod ni ecnadrocca htiw mret-# noitpmusbus and .noitacifinu roF ,elpmaxe nevig a elpmis erutangis rof eht noitacificeps fo raenil lists 9= htiw and {list, cons, nil} nil < list cons < list, ti is tey elbissop ot yficeps that has an etubirtta eW shall yficeps cons tail-list. this as: list := {nil; cons(tai1 * list)}. morF hcihw eht etairporppa gniredro-laitrap is .derrefni As ni this ,elpmaxe hcus epyt snoitinifed yam eb .evisrucer ,nehT -acifinu-$ list noit hcus a epyt noitacificeps sdeecorp yb gnidlofnu epyt slobmys -drocca modulo gni ot rieht .snoitinifed sihT is enod yb deen as on noisnapxe fo slobmys deen eb enod ni esac fo )1( seruliaf eud ot citeroeht-redro sehsalc ,.g.e( cons(tail- list) deifinu htiw ;sliaf sevig J_ ;) )2( lobmys noitpmusbus ,.g.e( deifinu htiw nil i.e., cons list sevig just cons), and )3( ecnesba fo etubirtta ,.g.e( 1iat(snoc - cons) deifinu htiw sevig ,suhT etubirtta ecnatirehni yam eb enod ”,ylizal“ cons cons( tail =j cons>). gnivas hcum yrassecennu snoisnapxe .]ll[ nI ,EFIL a cisab mret@ setoned a lanoitcnuf noitacilppa ni s’LOOF esnes fi its toor lobmys is a denifed .noitcnuf ,suhT a is rehtie a mret-$ functional expression ro a noitcnujnoc fo smret-+ detoned yb ,t : ,t : 1.1 : 3.,t nA elpmaxe fo hcus is erehw is eht LOOF noitcnuf denifed as: append(list, L): list, append list := {[I; [@Ilist]}. append([ 1, L : list> -+ L. append([HIT : list], L : list) + [HIappendCT, .l)L nI‘ ,tcaf ew esoporp ot ees eht noitaton -:- ylpmis sa a cidayd noitarepo gnitluser ni eht BLG fo sti stnemugra ,ecnis rof ,elpmaxe eht noitaton X: ,t : zt si dnahtrohs rof X: ,,t X: .,I erehW eht elbairav X si ton ,yrassecen ,.ei( ton esiwrehto derahs ni eht ,)txetnoc ew yam suht ylpmis etirw ,t : .2t 202 H. AiT-KACI AND A. PODELSKI sihT is woh lanoitcnuf ycnedneped stniartsnoc era desserpxe ni a mret-$ ni .EFIL roF ,elpmaxe ni EFIL eht mret-$ rab(oof :X* list, baz a Y: list, fuz * ,X(dneppu )Y : list> is eno ni hcihw eht etubirtta @ is devired as a deulav-tsil noitcnuf fo eht setubirtta rab and .zub gniyfinU hcus smret-$ sdeecorp as erofeb oludom noisnepsus fo lanoitcnuf snoisserpxe esohw stnemugra era ton yltneiciffus denifer ot eb ylbavorp subsumed yb snrettap fo noitcnuf .snoitinifed As rof lanoitaler stniartsnoc no stcejbo ni ,EFIL a mret-+ t yam eb dewollof yb a such-that esualc gnitsisnoc fo eht lacigol noitcnujnoc fo )lanoitaler( slaretil C 1,. . . , C,,, ylbissop gniniatnoc lanoitcnuf .smret tI is nettirw as tlC,, . . . , C,. -ifinU noitac fo hcus yllanoitaler deniartsnoc smret is enod oludom gnivorp eht deniojnoc .stniartsnoc eW lliw etartsulli this yrev gniugirtni erutaef htiw owt :selpmaxe prime. 1 i f e noitceS( )5.2 and quick. 1 i f e noitceS( .)4.2 nI ,tceffe this swolla gniyficeps duemonic construints ot eb dehcatta ot .stcejbo hcuS a )demaner( ”deniartsnoc-nomead“ s’tcejbo deificeps lanoitaler and )lanoitauqe( lanoitcnuf alumrof is dezilamron yb ,EFIL its foorp gnieb dereggirt yb noitacifinu at eht s’tcejbo noitaerc .emit eW evig txen emos EFIL .selpmaxe 2.2. Order-sorted logic programming: happy 1. i f e ehT tsrif elpmaxe setartsulli a esu fo deredro-yllaitrap stros ni cigol .gnimmargorp ehT smret-e devlovni ereh era ylno cimota ;smret-$ i.e., detubirttanu tros .slobmys sihT elpmaxe shows eht egatnavda fo gnizirammus eht tnetxe fo a noitaler htiw s’etaciderp stnemugra gnignar revo sepyt rehtar than .slaudividni ,reteP luaP and yraM era ,stneduts and stneduts era .snosrep student:= {peter;paul;mary}. student< Iperson. sedarG era doog sedarg ro bad .sedarg A and B era doog ,sedarg elihw C, D and F era bad .sedarg grade:= {goodgrade;badgrade}. goodgrade:= {a;b}. badgrade:={c;d;f}. sedargdooG era doog things. goodgrade< Igoodthing. yrevE nosrep sekil .flesreh yrevE nosrep sekil yreve doog .gniht reteP sekil .yraM likes(X:person,X) . likes(person,goodthing). likes(peter,mary). 203 SDRAWOT A GNINAEM FO EFIL reteP tog a C, luaP an F and yraM an A. got(peter,c) . got(paul,f) . got(mary,a) . A nosrep is yppah fi eh/s tog gnihtemos that eh/s ,sekil ,ro fi eh/s sekil gnihtemos that tog a doog .gniht happy(X:person) :- got(x,Y),likes(X,Y). happy(x:person) :- likes(X,Y),got(Y,goodthing). oT eht yreuq ‘happy(X:student) ’? EFIL answers x = yram ees-eciwt( ,)?yhw neht sevig x =peter, neht .sliaf tI( spleh ot draw eht tros yhcrareih redro ).margaid 2.3. Passive constraints: 1 e fun . 1 i f e The txen eerht selpmaxe etartsulli eht yalpretni fo noitacifinu and elbaterpretni .snoitcnuf ehT tsrif owt od ton ekam yna cificeps esu fo .smret-q Again, eht redro-tsrif mret noitaton is desu as ticilpmi xatnys rof smret-G htiw laciremun .serutaef redisnoC tsrif eht :gniwollof P(X, Y) :- q(x, Y, Z, Z), r(X, Y). q(X, Y, X+Y, x*Y). q(X, Y, X+Y, (X*Y)-14). r(3, 5). r(2, 2). r(4, 6). nopU a yreuq ‘p (x, Y) ’? eht etaciderp p stceles a riap fo snoisserpxe ni X and Y esohw snoitaulave must ,yfinu and neht stceles seulav rof X and Y. ehT tsrif noitulos detceles yb etaciderp q sets up eht laudiser noitauqe ro( ro residuation, that X + Y = X * Y erom( ylesicerp that htob X + Y and X * Y dluohs suspension) yfinu htiw Z>, hcihw is ton deifsitas yb eht tsrif riap fo ,seulav tub is yb eht .dnoces ehT dnoces noitulos sets up X + Y = X( * )Y - 14, hcihw is deifsitas yb X = 4, Y= 6. ehT txen owt selpmaxe wohs eht esu fo redro-rehgih snoitcnuf hcus as map: map(@, [ I)-,[ I. maP(F, [HITI) --f [F(H) Imap(F,T)l. inc_list(N:int, L:list, map(+(N),L)). 204 H. AiT-KACI AND A. PODELSKI Tothequely‘inc_list(3, .17,6,5,4[=LsrewsnaEFIL,‘?)L,l4,3,2,1[ nI passing, eton eht ni-tliub tnatsnoc @ as eht lavemirp EFIL tcejbo yllamrof( nettirw T) hcihw setamixorppa gnihtyna ni eht .esrevinu etoN that ti is ,elbissop ecnis EFIL uses smret-$ as a lasrevinu tcejbo ,erutcurts ot pass stnemugra ot snoitcnuf yb sdrowyek and niatbo eht rewop fo laitrap noitacilppa )gniyrruc( ni all ,stnemugra as desoppo ot suluclac-h hcihw seriuqer thgir-ot-tfel gniyrruc .13[ roF elpmaxe fo an )evitceles-tnemugra( ,gniyrruc redisnoc eht dettimda( )lacigolohtap EFIL :margorp curry(V) :- V=G(2*1), G=F(X), valid(F), pick(x), p(sq(V)). sq(X) +x*x. twice(F,X)+F(F(X)). valid(twice) . P(l). id(x) -+X. pick(id). What seod EFIL rewsna nehw ‘curry (v) ?' is eht ?yreuq ehT noitaler curry is eht ytreporp fo a elbairav /I nehw this elbairav is eht tluser fo gniylppa a elbairav noitcnuf G ot eht rebmun 1 as its dnoces .tnemugra tuB G must osla eb eht eulav fo gniylppa a elbairav noitcnuf F ot an nwonknu tnemugra X. ehT etaciderp valid binds F ot twice, and erofereht binds V ot twice (x, 1). ,nehT pick binds X ot eht ytitnedi .noitcnuf ,suhT eht eulav fo ,G twice )x( , semoceb twice (id) and V semoceb won dnuob ot 1, eht eulav fo twice (id, 1). ,yllaniF ti must eb deifirev that eht erauqs fo /I seifinu htiw a eulav gniyfsitas ytreporp p. 2.4. Functional programming with logical variables: quick 1. i f e sihT is a small EFIL eludom gniyficeps dna( thus, )gnitnemelpmi C.A.R. s’eraoH kciuQ“ ”troS mhtirogla .yllanoitcnuf sihT noisrev skrow no lists hcihw era ton detanimret htiw [ 1 )lin( tub htiw detaitnatsninu selbairav ro( yllaitrap -itnatsni deta ot a laminim-non list .)tros ,eroferehT EFIL sekam stsil-ecnereffid bona fide data serutcurts ni lanoitcnuf .gnimmargorp q_sort(L,order*O) +undlist(dqsort(L,ordertiO)). undlist(x\Y)+XIY=[ .1 dqsort([ l)+L\L. dqsort( [HITl,order*O) + (~l\L2) : where ((Less,More) : split(H,T, ( [ I,[ l),order*O), (Ll\[HIL31) : dqsort(Less ,order*O), (L3\L2) : dqsort(More ,order*O)). where -+ @ .

Description:
Logic Programming scheme due to Hijhfeld and Smolka refining that of As an acronym, 'LIFE' means Logic, Inheritance, Functions, and Equations. LIFE.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.