A treatment of higher-order features in logic prog

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ATreatmentofHigher-OrderFeaturesinLogiProgrammingGopalanNadathurDepartmentofComputerSieneandEngineeringUniversityofMinnesota4-192EE/CSBuilding,200UnionStreetS.E.Minneapolis,MN55455gopalans.umn.eduAbstratThelogiprogrammingparadigmprovidesthebasisforanewintensionalviewofhigher-ordernotions.Thisviewisrealizedprimarilybyemployingthetermsofatypedlambdaalulusasrepresentationaldeviesandbyusingariherformofuniationforprobingtheirstrutures.Theseadditionshaveimportantmeta-programmingappliationsbuttheyalsoposenon-trivialimplementationproblems.Oneissueonernsthemahinerepresen-tationoflambdatermssuitabletotheirintendeduse:anadequateenodingmustfailitateomparisonoperationsovertermsinadditiontosupportingtheusualredutionomputa-tion.Anotheraspetrelatestothetreatmentofauniationoperationthathasabranhingharaterandthatsometimesallsforthedelayingofthesolutionofuniationproblems.Analissueonernstheexeutionofgoalswhosestruturesbeomesapparentonlyintheourseofomputation.Thesevariousproblemsareexposedinthispaperandsolutionstothemaredesribed.Asatisfatoryrepresentationforlambdatermsisdevelopedbyexploit-ingthenamelessnotationofdeBruijnaswellasexpliitenodingsofsubstitutions.SpeialmehanismsaremoldedintothestrutureoftraditionalPrologimplementationstosupportbranhinginuniationandarryingofuniationproblemsoverotheromputationsteps;apremiumisplaedinthisontextonexploitingdeterminismandonemulatingusualrst-orderbehaviour.Anextendedompilationmodelispresentedthattreatshigher-orderuniationandalsohandlesdynamiallyemergentgoals.TheideasdesribedherehavebeenemployedintheTeyjusimplementationoftheProloglanguage,afatthatisusedtoobtainapreliminaryassessmentoftheireÆay.Keywords:lambdaalulus,intensionalhigher-orderprogramming,higher-orderunia-tion,abstratmahine,ompilation.1IntrodutionCustomaryaquaintanewithhigher-ordernotionsinprogrammingrelatestotheimperativeorfuntionalprogrammingparadigms.Withintheseframeworks,funtionsareequatedwiththemethodsforomputingthatareembodiedinproedures.Higher-ordernessthenonsistsoftheabilitytoobjetifysuhfuntionsand,thereby,toembedthemindataorpassthem1asargumentstootherfuntions.Manyinterestingappliationshavebeenfoundforsuhapabilities.However,allofthesearedependentonauniformextensionalviewoffuntions.Inpartiular,theonlyobservableaspetofsuhobjetsistheirabilitytotransformgivenargumentsintoresultvalues.Logiprogramminghasthepotentialforsupportingadierentand,insomesenses,moresophistiatedunderstandingofhigher-ordernotions[36℄.Funtionsareusedwithinthisparadigmasameansforonstrutingdesriptionsofobjets.Suhdesriptionsanbeexaminedbymeansofuniation,anoperationthatisusefulintheanalysisofintensions.Traditionallogiprogramminglanguagesmanifestaweakexploitationofthisapabilitybe-ausetheypermitonlyindividual,non-funtion,objetsasvalues.However,itispossibletosupporttheprobingoffuntionstrutureingenuinelyhigher-orderwaysbyintroduingamehanismsuhasthetermsofalambdaalulusforenodingfuntionobjetsandbyomplementingthiswithrihernotionsofvariablesanduniation.Theusualformofhigher-orderprogramminganberealizedsimplybyusingtheabilitytorepresentfuntionvaluedobjetsandtheextensionalinterpretationbuiltintologiprogrammingofonekindoffuntion,namely,prediates.Theriherintensionalviewoffuntionsoers,inaddition,manypossibilitiesthathavenotbeensystematiallysupportedbyanypreviousprogram-mingparadigm.Toonsideroneimportantdiretion,theabilitytouselambdatermsasrepresentationaldevieslendsitselfwelltoanabstratviewofsyntaxthattreatsbindingnotionsexpliitly[27,41℄,leadingtherebytomanynovelmetalanguageappliationsforlogiprogramming(e.g.,see[5,15,17,18,40℄).Whilethereisonsiderableappliationpotentialforhigher-orderfeaturesinlogipro-gramming,theadditionofsuhfeaturesalsoraisessigniantimplementationproblems.Oneategoryofproblemsarisesfromtheusethatismadeofthetermsofalambdaalu-lusessentiallyasdatastrutures.Thisisatrulynovelroleforsuhtermsinprogramming,andarepresentationmustbedevelopedforthemthatsupportstheiruseinthisapaity.Asatisfatoryrepresentationshouldpermittheexaminationoftermstrutureandmustfailitatetheomparisonoftermsinasituationwherethepartiularnamesofboundvari-ablesareunimportant,inadditiontoeÆientlysupportingtheusualredutionoperationonterms.Anotherlassofproblemsrelatestothefatthattheuniationomputationonlambdaterms,knownashigher-orderuniation[20℄,possessesharaterististhataredistintfromthoseoftheustomaryrst-orderuniation.Inpartiular,performingthisoperationmayinvolveabranhingsearhanditmayalsobeneessarytotemporarily‘suspend’theomputationbeforeaunierisfound.Suitabledynamisupportmustbedesribedforbothfaets.Athirdaspetthatneedsspeialonsiderationisthemixingofintensionalandextensionalviewsofprediateobjets.Thereisadistintionbetweenexaminingthestrutureofanobjetandusingthisstruturetodeterminetheinvoationofode.Asatisfatorymethodmustbeprovidedforrealizingtheswithbetweentheseroles.Finally,anymahinerythatisdesignedforsupportingthenewfeaturesmustbein-terwovenintotherun-timedeviesandapproahestoompilationthatareommonlyusedinlogiprogrammingimplementation.Theproperombinationofallthesemehanismsinonesyst

1 / 51
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功