:167121742(2003)0420371205PROLOG(,524005):,PROLOG:;;PROLOG:TP182:B11968E.A.FeigenbaumC.DjerassiJ.LeberbergDENDRAL,,,,PROLOG22.1,,E.A.Feigenbaum:,NilsJ.Nilsson:Allprogramsthatachieveexpert2levelcompetenceinsolvingproblemsbybringtobearabodyofknowledgearecalledknowledge2basedsystemsorexpertsystems.:,2.2,,,1,:,,,,,,,,,():,,,,,,,,:2003203231;:2003206211184200312JOURNALOFCHENGDUUNIVERSITYOFINFORMATIONTECHNOLOGYVol.18No.4Dec.2003,,,,,,,,13PROLOG,PROLOG73.1,7,15R1IFTHENR2IFTHENR3IFTHENR4IFANDTHENR5IFTHENR6IFANDANDTHENR7IFANDTHENR8IFANDTHENR9IFANDANDANDTHENR10IFANDANDANDTHENR11IFANDANDANDTHENR12IFANDTHENR13IFANDANDANDTHENR14IFANDANDANDTHENR15IFANDTHEN27318,,3,,7223.2:,,,,:?3.3,,333.4PROLOG/33/databasexpositive(symbol,symbol).xnegative(symbol,symbol).predicates3734:PROLOGrun.animal-is(symbol).it-is(symbol).positive(symbol,symbol).negative(symbol,symbol).clear-facts.remember(symbol,symbol).ask(symbol,symbol)./33/clausesrun:-animal-is(X),!,write(\nYouranimalmaybea(n),X),nl,nl,clear-facts.run:-write(\nUnabletodeterminewhat),write(youranimalis\n\n),clear-facts.positive(X,Y):-xpositive(X,Y),!.positive(X,Y):-not(xnegative(X,Y))andask(X,Y).negative(X,Y):-xnegative(X,Y),!.negative(X,Y):-not(xpositive(X,Y))andask(X,Y).ask(X,Y):-write(X,it,Y,\n),readln(Reply),remember(X,Y,Reply).remember(X,Y,yes):-assertz(xpositive(X,Y)).remember(X,Y,no):-assertz(xnegative(X,Y)),fail.clear-facts:-retract(xpositive(-,-)),fail.clear-facts:-retract(xnegative(-,-)),fail.clear-facts:-write(\n\nPleasepressthespacebartoExit),readchar(-)./33/it-is(mammal):-positive(has,hair).it-is(mammal):-positive(does,give-milk).it-is(bird):-positive(has,feathers).it-is(bird):-positive(does,fly)andpositive(does,lay-eggs).it-is(carnivore):-positive(does,eat-meat).it-is(carnivore):-positive(has,pointed-teeth)andpositive(has,claws)andpositive(has,forward-eyes).it-is(ungulate):-it-is(mammal)andpositive(has,hooves).it-is(ungulate):-it-is(mammal)andpositive(does,chew-cud).animal-is(cheetah):-it-is(mammal)andit-is(carnivore)andpositive(has,tawny-color)andpositive(has,black-spots).animal-is(tiger):-it-is(mammal)andit-is(carnivore)andpositive(has,tawny-color)andpositive(has,black-stripes).animal-is(giraffe):-it-is(ungulate)andpositive(has,long-neck)andpositive(has,long-legs)positive(has,dark-spots).animal-is(zebra):-it-is(ungulate)andpositive(has,black-stripes).47318animal-is(ostrich):-it-is(bird)andpositive(has,long-neck)andpositive(has,long-legs)andnegative(does,fly).animal-is(penguin):-it-is(bird)andpositive(does,swim)andnegative(does,fly)andpositive(has,black-and-white-color).animal-is(albatross):-it-is(bird)andpositive(does,fly-well).3.5R1,R1,,R2,,R2,,:,,,,,R2,R3,R4,R5,R6,R7,,R7,,:,,,,,,,R8,R9,R10R11,ANDANDAND,R11,,,4,,,PROLOG:[1]NilsJ.Nilsson.ArtificialIntelligenceANewSynthesis[M].:,1999.[2].[M].:,2000.[3].[M].:,2001.[4].()[M].:,1995.[5],.[M].:,1989.[6],.()[M].:,1996.[7].TURBOPROLOG[M].:,1989.[8].[M].:,1991.[9],.[M].:,2001.ImplementationofananimalrecognitionexpertsystembyPrologXIAMing2hua(Dept.ofElectronics&InformationEngineering,ZJOU,Zhanjiang524004,China)Abstract:Theprincipleoftheexpertsystemispresented.TheanimalrecognitionexpertsystemisimplementedwiththeprogramminglanguagePROLOG.Keywords:expertsystem;animalrecognition;PROLOG5734:PROLOG