PROLOG language
Introduction
Alogicprogramminglanguage.In1972,inordertoimprovetheexecutionefficiencyoftheresolutionmethod,theFrenchComorauerteamdevelopedaprogramexecutorforthetheoremprovingprogram,namedPROLOG(ProgrammingInLogic),markingthebirthofthefirstlogicprogramminglanguagePROLOG.In1974andafter,R.KowalskifurtherclarifiedthetheoreticalbasisofPROLOGfromtheperspectiveoftheHORNclauseofpredicatelogic,andsystematicallyproposedtheideaoflogicalprogramming.
TherearethreetypesofbasicsentencesinPROLOGlanguage,whichrepresentfacts,rules,andqueries,andcorrespondtotheHORNclauseswithhead(withoutbody,body)andheadless.Forexample:
SotheprogramminginPROLOGlanguagecanbeboileddowntodeclaringfacts,definingrulesandaskingquestions.
TheexplanationandexecutionprocessofthePROLOGprogramusesaspecificinputresolution,thatis,startingfromthetargetsentence,findtheresolution(tailandheadmatching)ofaclauseintheoriginalclauseset,andthenewclauseThenfindtheresolutionwithaclauseintheoriginalclauseset,andsoon.Atanytime,noresolutionisfoundbetweentwoderivedclausesortwoclausesoftheoriginalclauseset.Intheaboveexample
⑥:-human(u),greek(u)(theresolutionof④and⑤,mgu=u/x)
⑦:-greek(socarates)(Theresolutionof②and⑥,mgu=socarates/u)
⑧:-(Theresolutionof③and⑦,getemptyclauses)
Theanswertothequestionisu=socarates.ItcanbeseenthatthePROLOGinterpretationsystemisactuallyatheoremprovingprogramorproblemsolvingprogrambasedontheresolutionprinciple.
Lowspace-timeefficiencyisanimportantissuethataffectstheapplicationofthePROLOGlanguage.Thewaystoimproveefficiencyare:improvethePROLOGinterpretationsystem,adoptthePROLOGcompilationsystem,developthePROLOGmachine,introducethemeta-rulesforcontrol,anduseheuristicsSearchmode,enableintelligentbacktracking,adoptcollaborativeandconcurrentsolvingtechnology,anddevelopparallelprocessingmechanisms.
BecausethePROLOGinterpretercanautomaticallyfindthesolutionoftheproblemaccordingtotheinferencerules,theprogrammercanfocusonrevealingthelogicalrelationshipbetweentheobjectswithouthavingtoconsiderthedetailsoftheprocesstoomuch.Astepforwardinthedirectionofautomaticprogramming.ButPROLOGlanguagealsohassomenon-logicalcharacteristics.Forexample,inordertocontrolthebacktracking,theCUTtechnology(cuttingtechnology,whichmeansthattheprogrampersonnelusetheCUTsymbol!Informsthesystemtonolongerconsidertheuselesssearchpaththathasbeencarriedoutinthepastandthereisnoneedtorecordthetechnologyofthebacktrackingpoint),andintroducethepredicateassert(inthedatabaseAddclause)retract(deleteclausefromthedatabase).Thismakesthesetofaxiomsofthesystemchangeintheprocessofreasoning,whichareinconsistentwiththebasicideasofthesameorderoflogic.Therefore,PROLOGisnotalogicalprogramminglanguageinthestrictsense.Inordertomakeitmorelogical,itisnecessarytolimitthenon-logicalcomponentsoflanguagetoaminimum.Researchinthisareaisongoing.
Bibliography
W.F.ClocksinandC.S.Mellish,ProgramminginProlog,Springer-Verlag,Berlin,1981.
Latest: Multicast