Logic programming language

ThesynonymProloggenerallyreferstothelogicprogramminglanguage.

Aboutthelogicprogramminglanguage

Prologisbasedontheprocessingoffirst-orderpredicatecalculus,duetoitssimplegrammar,richexpressivenessanduniquenon-procedurallanguageThecharacteristicsofitareverysuitableforexpressinghumanthinkingandreasoningrules,whichhaswonthewidespreadinterestofartificialintelligenceresearchandapplicationdeveloperswhenitcameout.EspeciallyinWesternEuropeandJapan,theProloglanguagehasbeenpopularizedinmanyapplicationfields,suchasrelationaldatabases,mathematicallogic,abstractproblemsolving,naturallanguageunderstanding,andexpertsystems.JapanalsolistedPrologasthecorelanguageinitsfifth-generationcomputerresearchplanproposedin1979.

Prologisactuallyadeductivereasoningtechniquebasedonreverserules,buttherearestrictrestrictionsontheexpressionofrulesandgoals.Coupledwiththesimplicityofthedeductivereasoningcontrolmechanismitself,itisdifficulttoapplytocomplexapplicationdomains.

ThebasicconceptsoftheProloglanguage

ThebasiccomponentoftheProloglanguageistheHornclause,expressedinthefollowingform:

∧∧p;

IntheProloglanguage,theHornclausetakesthreeformsTheyrespectivelyrepresentthethreepartsoftheproblem-solvingdescriptioninreversedeductivereasoning:goals,rulesandfacts.

Target

ItisexpressedasaHornclausewithonlytheleftpart:

∧∧

∧;

Thatis,intheProloglanguage,thetargetformulaislimitedtobeexpressedastheconjunctionofatomicformulas,andcannotbeanytextandorform.

Rules

ExpressedasatypicalHornclause:

∧∧

∧p

ThisisthenormalizedBruleusedinreversedeductivereasoning,buttheleftpartoftheruleislimitedtotheconjunctionofatomicformulas.Ratherthanarbitrarywordsandorshapes.

Facts

Factsarerepresentedasacollectionoffactelements,andeachfactelementisrepresentedasaHornclausewithonlytherightpart,thatis,asingleatomicformulaP.Implicitconjunctiverelationsbetweenfactelements.

AslongasthethreepartsoftheproblemdescriptionareexpressedinProloglanguage,thereasoningmechanismthatsupportsPrologsentenceswillautomaticallyperformrule-basedreversedeductivereasoning,andfinallygiveanswers.

Becausethegoalandtheleftpartoftherulesarelimitedtotheconjunctionofatomicformulas,theseatomicformulascanactivatemultiplerules(thereareimplicitorrelationsbetweentheserules).Therefore,theAND-ORgraphestablishedbyProlog'sdeductivereasoningprocesshasanand-orrelationshipthatalternateslayerbylayer.Withthedownwardexpansionoftheandorgraph,aconsistentsolutiongraphwilleventuallybeformed(searched),andthedeductivereasoningwillsucceed;otherwise,thereasoningwillfail.

Theatomicformulascontainedinthetargetareregardedassub-goals.Whenevertheruleactivatedbythesub-goalisinsertedintotheAND-ORgraph,theatomicformulasontheleftoftherulebecomenewsub-goalsandthenusedActivateanewrule;inthisway,withtheactivationoftheruleandthegenerationofanewsub-goal,theAND-ORgraphisgraduallyexpandeduntilthesub-goaldirectlymatchesthefactelement(atomicformula).

Features

ThegrammaticalstructureoftheProloglanguageisquitesimple,butthedescriptionabilityisverystrong.Forexample,whenfactsandrulesdescribetheaxiomsofacertaindiscipline.Thentheproblemisthepropositiontobeproved;whenfactsandrulesdescribecertaindataandrelationships,thentheproblemisadataquerystatement;whenfactsandrulesdescribecertainstatechangelaws,thentheproblemisthetargetstate.Therefore,Prologlanguageisanintelligentprogramminglanguage.

ThePrologprogramhasnospecificrunningsequence,andthesequenceofrunningtheprogramiscarriedoutcompletelyinaccordancewithmathematicallogicdeduction(digestionmethod).Itisnotdeterminedbytheprogrammer.Prologisadescriptivelanguagethatusesaspecificmethodtodescribeaproblem,andthenthecomputerautomaticallyfindstheanswertotheproblem.Takeanextremeexample:whenthefactsandrulesareestablished,youonlyneedtotellitacertainquestion,anditwillautomaticallyfindtheanswer.

Therearenocontrolflowstatementssuchasif,case,andforinthePrologprogram.Undernormalcircumstances,programmersdonotneedtounderstandtherunningprocessoftheprogram,onlyneedtopayattentiontowhetherthedescriptionoftheprogramiscomprehensive.However,Prologalsoprovidessomemethodsforcontrollingprogramflow,whicharequitedifferentfromthoseinotherlanguages.

Related Articles
TOP