您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 数据通信与网络 > Higher-order logic programming
CS-1994-38Higher-OrderLogicProgrammingGopalanNadathurDaleMillerDepartmentofComputerScienceDukeUniversityDurham,NorthCarolina27708{0129December1994Higher-OrderLogicProgrammingyGopalanNadathurzComputerScienceDepartment,DukeUniversityDurham,NC27706gopalan@cs.duke.eduPhone:+1(919)660-6545,Fax:+1(919)660-6519DaleMillerComputerScienceDepartment,UniversityofPennsylvaniaPhiladelphia,PA19104-6389USAdale@saul.cis.upenn.eduPhone:+1(215)898-1593,Fax:+1(215)898-0587yThispaperistoappearintheHandbookofLogicinArti cialIntelligenceandLogicProgramming,D.Gabbay,C.HoggerandA.Robinson(eds.),OxfordUniversityPress.zThisaddressisfunctionalonlyuntilJanuary1,1995.Afterthisdate,pleaseusethefollowingaddress:DepartmentofComputerScience,UniversityofChicago,RyersonLaboratory,1100E.58thStreet,Chicago,IL60637,Email:gopalan@cs.uchicago.edu.Contents1Introduction32MotivatingaHigher-OrderExtensiontoHornClauses53AHigher-OrderLogic123.1TheLanguage::::::::::::::::::::::::::::::::::::::::123.2EqualitybetweenTerms::::::::::::::::::::::::::::::::::143.3TheNotionofDerivation:::::::::::::::::::::::::::::::::173.4ANotionofModels::::::::::::::::::::::::::::::::::::193.5PredicateVariablesandtheSubformulaProperty::::::::::::::::::::214Higher-OrderHornClauses235TheMeaningofComputations275.1RestrictiontoPositiveTerms:::::::::::::::::::::::::::::::285.2ProvabilityandOperationalSemantics::::::::::::::::::::::::::326TowardsaPracticalRealization356.1TheHigher-OrderUni cationProblem::::::::::::::::::::::::::356.2P-Derivations::::::::::::::::::::::::::::::::::::::::386.3DesigninganActualInterpreter::::::::::::::::::::::::::::::427ExamplesofHigher-OrderProgramming457.1AConcreteSyntaxforPrograms:::::::::::::::::::::::::::::457.2SomeSimpleHigher-OrderPrograms:::::::::::::::::::::::::::487.3ImplementingTacticsandTacticals::::::::::::::::::::::::::::517.4ComparisonwithHigher-OrderFunctionalProgramming::::::::::::::::548Using -TermsasDataStructures568.1ImplementinganInterpreterforHornClauses:::::::::::::::::::::578.2DealingwithFunctionalProgramsasData:::::::::::::::::::::::608.3AShortcomingofHornClausesforMeta-Programming::::::::::::::::669HereditaryHarropFormulas689.1PermittingUniversalQuanti ersandImplicationsinGoals::::::::::::::689.2RecursionoverStructuresthatIncorporateBinding:::::::::::::::::::7010Conclusion7811Acknowledgements7921IntroductionModernprogramminglanguagessuchasLisp,SchemeandMLpermitprocedurestobeencapsulatedwithindatainsuchawaythattheycansubsequentlyberetrievedandusedtoguidecomputations.Thelanguagesthatprovidethiskindofanabilityareusuallybasedonthefunctionalprogrammingparadigm,andtheproceduresthatcanbeencapsulatedinthemcorrespondtofunctions.Theobjectsthatareencapsulatedare,therefore,ofhigher-ordertypeandsoalsoarethefunctionsthatmanipulatethem.Forthisreason,theselanguagesaresaidtoallowforhigher-orderprogramming.Thisformofprogrammingispopularamongtheusersoftheselanguagesanditstheoryiswelldeveloped.Thesuccessofthisstyleofencapsulationinfunctionalprogrammingmakesisnaturaltoaskifsimilarideascanbesupportedwithinthelogicprogrammingsetting.Notingthatproceduresareimplementedbypredicatesinlogicprogramming,higher-orderprogramminginthissettingwouldcorrespondtomechanismsforencapsulatingpredicateexpressionswithintermsandforlaterretrievingandinvokingsuchstoredpredicates.Atleastsomedevicessupportingsuchanabilityhavebeenseentobeusefulinpractice.AttemptshavethereforebeenmadetointegratesuchfeaturesintoProlog(see,forexample,[War82]),andmanyexistingimplementationsofPrologprovideforsomeaspectsofhigher-orderprogramming.Theseattempts,however,areunsatisfactoryintworespects.First,theyhavereliedontheuseofadhocmechanismsthatareatvariancewiththedeclarativefoundationsoflogicprogramming.Second,theyhavelargelyimportedthenotionofhigher-orderprogrammingasitisunderstoodwithinfunctionalprogrammingandhavenotexaminedanotionthatisintrinsictologicprogramming.Inthischapter,wedeveloptheideaofhigher-orderlogicprogrammingbyutilizingahigher-orderlogicasthebasisforcomputing.Thereare,ofcourse,manychoicesforthehigher-orderlogicthatmightbeusedinsuchastudy.Ifthedesireisonlytoemulatethehigher-orderfeaturesfoundinfunctionalprogramminglanguages,itispossibletoadopta\minimalistapproach,i.e.,toconsiderextendingthelogicof rst-orderHornclauses|thelogicalbasisofProlog|inassmallawayaspossibletorealizetheadditionalfunctionality.Theapproachthatweadopthere,however,istoenunciateanotionofhigher-orderlogicprogrammingbydescribingananalogueofHornclauseswithinarichhigher-orderlogic,namely,Church’sSimpleTheoryofTypes[Chu40].Followingthiscoursehasanumberofpleasantoutcomes.First,theextensiontoHornclauselogicthatresultsfromitsupports,inanaturalfashion,theusualhigher-orderprogrammingcapabilitiesthatarepresentinfunctionalprogramminglanguages.Second,theparticularlogicthatisusedprovidestheelegantmechanismof -termsasameansforconstructingdescriptionsofpredicatesandthisturnsouttohavebene tsataprogramminglevel.Third,theuseofahigher-orderlogicblursthedistinctionbetweenpredicatesandfunctions|predicatescorrespond,afterall,totheirch
本文标题:Higher-order logic programming
链接地址:https://www.777doc.com/doc-4991856 .html