1 / 27

IES 503 ARTIFICIAL INTELLIGENCE

IES 503 ARTIFICIAL INTELLIGENCE. INFERENCE IN FIRST-ORDER LOGIC. İPEK SÜĞÜT. CONTENTS. PROPOSITIONAL VS. FIRST-ORDER LOGIC INFERENCE RULES FOR QUANTIFIERS UNIFICATION AND LIFTING FORWARD CHAINING BACKWARD CHAINING RESOLUTION CONCLUSION.

elia
Download Presentation

IES 503 ARTIFICIAL INTELLIGENCE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. IES 503 ARTIFICIAL INTELLIGENCE INFERENCE IN FIRST-ORDER LOGIC İPEK SÜĞÜT

  2. CONTENTS • PROPOSITIONAL VS. FIRST-ORDER LOGIC • INFERENCE RULES FOR QUANTIFIERS • UNIFICATION AND LIFTING • FORWARD CHAINING • BACKWARD CHAINING • RESOLUTION • CONCLUSION

  3. PROPOSITIONAL VS. FIRST-ORDER LOGIC INFERENCE RULES FOR QUANTIFIERS Withthehelp of theserules, we can converttheknowledgebasetopropositionallogicandusepropositionalinference in ordertousefirst-orderinference. Let us beginwithuniversalquantifiers. KB => standardfolkloricaxiomstatingthatallgreedykingsareevil: Then it is quiteeasytoinferany of thefollowingsentences:

  4. INFERENCE RULES FOR QUANTIFIERS • Universal Instantiation(UI):Infer any sentence obtained by substituting a ground term for the variable. Let denote the result of applying the substitution to the sentence . The rule is: for any variable and ground term . EXAMPLE: The three sentences given earlier are obtained with the substitutions • Existential Instantiation(EI):Morecomplicatedthan UI. Foranysentence variable , andconstantsymbolthatdoes not appearelsewhere in theknowledgebase:

  5. INFERENCE RULES FOR QUANTIFIERS EXAMPLE: => as long as does not appearelsewhere in the KB. *Theexistentialsentencesaysthere is someobjectsatisfying a condition, andtheinstantiationprocess is justgiving a name tothatobject. Mathematicsprovide a nice example:Supposewediscoverthatthere is a numberthat is littlebiggerthan 2.71828 andthatsatisfiestheequationforWe can givethisnumber a name, such as , but it would be mistaketogive it the name of an existingobject, such as . Inlogic, thenew name is called a Skolemconstantand EI is a specialcase of a more general processcalledskolemization.

  6. REDUCTION TO PROPOSITIONAL INFERENCE • Just as an existentiallyquantifiedsentence can be replacedbyoneinstantiation, a universallyquantifiedsentence can be replacedbythe set of allpossibleinstantiations. EXAMPLE:Our KB containsjustthesentences: Then, weapply UI tothefirstsentenceusingallpossiblegroundtermsubstitutions: Weobtain : Thistechnique is calledpropositionalization. There is a problem withthistechniqueifwehave a functionsymbol in KB. Because it gives us an infinite set of possiblegroundtermsubstitutionssuch as

  7. UNIFICATION AND LIFTING A first-orderinferencerule:Supposethatinstead of knowingweknowthateveryone is greedy: Then, wewouldstillliketo be abletoconcludethatbecauseweknowthat John is a kingand John is greedybecauseeveryone is greedy. Thisinferenceprocess can be captured as a singleinferencerulethatwecallGeneralizedModusPonens: Foratomicsentences, wherethere is a substitution 8 suchthat, foralli, EXAMPLE:

  8. UNIFICATION AND LIFTING *GeneralizedModusPonens is a liftedversion of ModusPonens (it raisesModusPonensfrompropositionaltofirst-orderlogic). *Thekeyadvantage of liftedinferencerulesoverpropositionalization is thattheymakeonlythosesubstitutionswhicharerequiredtoallowparticularinferencestoproceed. Unification:Liftedinferencerulesrequirefindingsubstitutionsthatmakedifferentlogicalexpressionslookidentical. Thisprocess is calledunificationand is a keycomponent of allfirst-orderinferencealgorithms. Thealgorithmtakessentencesandreturns a unifierforthemifoneexists: EXAMPLE:Supposewehave a query Someanswers can be foundbyfindingallsentences in KB thatunifywith. Here aretheresults of unificationwithfourdifferentsentences:

  9. UNIFICATION AND LIFTING Thelastunificationfailsbecause x cannottake on thevaluesJohnandElizabeth at thesame time. The problem can be avoidedbystandardizing apart one of thetwosentencesbeingunified, whichmeansrenamingitsvariablestoavoid name clashes. Forexample, we can renamex in to (a newvariable) withoutchangingitsmeaning. Nowtheunificationwillwork:

  10. UNIFICATION AND LIFTING Storage andRetrieval:Wehavetwofunctions STORE and FETCH. STORE(s) stores a sentence s intothe KB and FETCH(q) returnsallunifierssuchthatthequery q unifieswithsomesentence in the KB. The problem usedtoillustrateunification(findingallfactsthatunifywith is an instance of FETCHing. We can make FETCH moreefficientbyensuringthatunificationsareattemptedonlywiththesentencesthathavesomechance of unifying. EXAMPLE:There is nopoint in tryingtounifywith. We can avoidsuchunificationsbyindexingthefacts in KB. A simpleschemecalledpredicateindexingputsalltheKnowsfacts in onebucketandalltheBrotherfacts in another. Thebuckets can be stored in a hashtableforefficientsuccess. EXAMPLE:Supposethatthetaxauthoritieswanttokeeptrack of whoemployswhom, using a predicate.

  11. UNIFICATION AND LIFTING Given a sentenceto be stored, it is possibletoconstructindicesforallpossiblequeriesthatunifywith it. Forthefact, thequeriesare Thesequeries form a subsumptionlatticeas shown in figure:

  12. FORWARD CHAINING First-OrderDefiniteClauses: Definiteclausesare a suitable normal form forusewithGeneralizedModusPonens. Not everyknowledgebase can be convertedinto a set of definiteclauses, but many can. Considerthefollowing problem: Thelawsaysthat it is a crimefor an Americantosellweaponstohostilenations. ThecountryNono, an enemy of America, has somemissiles, andall of itsmissilesweresoldto it byColonel West, who is an American. Wewillprovethat West is a criminal. First, first-orderdefiniteclauses: • ‘’… it is a crimefor an Americantosellweaponstohostilenations’’: • ‘’Nono … has somemissiles.’’ Thesentence is transformedintotwodefiniteclausesbyExistentialElimination, with a newconstant: • ‘’All of itsmissilesweresoldto it byColonel West’’:

  13. FORWARD CHAINING • Wewillalsoneedtoknowthatmissilesareweapons: • andwemustknowthat an enemy of Americacounts as ‘’hostile’’: • ‘’West,who is American ….’’: • ‘’ThecountryNono, an enemy of America ….’’: This KB containsnofunctionsymbolsand is therefore an instance of theclass of DatalogKB which is a set of first-orderdefiniteclauseswithnofunctionsymbols. A Simple ForwardChaining:Theimplicationsentencesare (9.1),(9.4),(9.5) and (9.6). Twoiterationsarerequired: • On thefirstiteration, rule (9.1) has unsatisfiedpremises. Rule(9.4) is satisfiedwith, and is added. Rule(9.5) is satisfiedwith, and is added. Rule(9.6) is satisfiedwith, and is added.

  14. FORWARD CHAINING • On theseconditeration, rule (9.1) is satisfiedwith, and is added. Theprooftree is as shownbelow:

  15. BACKWARD CHAINING Thisalgorithmtakesthefirstgoal in thelistandfindseveryclause in KB whosepositiveliteral, orhead, unifieswiththegoal. Eachsuchclausecreates a newrecursivecall in whichthepremise, orbody, of theclause is addedtothegoalstack. Rememberthatthefactsareclauseswith a head but no body, sowhen a goalunifieswith a knownfact, nonewsubgoalsareaddedtothestackandthegoal is solved. Thefigureshowstheprooftree:

  16. RESOLUTION Conjunctive Normal Form for First-OrderLogic: Toillustratetheprocedurebytranslatingthesentence ‘’Everyonewholovesallanimals is lovedbysomeone’’ Thestepsare as follows: • Eliminateimplications: • Moveinwards: Thesentencenowreads ‘’Eitherthere is someanimalthat x doesn’tlove, orsomeoneloves x’’. Clearly, themeaning of theoriginalsentence is preserved. • Standardize variables: • Skolemize: where F and G areskolemfunctions. • Dropuniversalquantifiers: • Distributeover:

  17. RESOLUTION TheResolutionInferenceRule:First example is thecrimeexample as shown: Thestructure:Beginningwiththegoalclauseand, resolvingagainstclausesfrom KB untiltheemptyclause is generated. CNF SENTENCES

  18. RESOLUTION Second examplemakesuse of Skolemizationandinvolvesclausesthatare not definiteclauses. The problem as follows: Everyonewholovesallanimals is lovedbysomeone. Anyonewhokills an animal is lovedbynoone. Jacklovesallanimals. EitherJackorCuriositykilledthecat, who is named Tuna. DidCuriositykillthecat? First, weexpresstheoriginalsentences, some background knowledge, andthenegatedgoal G in first-orderlogic:

  19. RESOLUTION Now, theconversionprocedure is usedtoconverteachsentenceto CNF:

  20. RESOLUTION TheParaphrasedProof: • SupposeCuriositydid not kill Tuna. • WeknowthateitherJackorCuriositydid; thusJackmusthave. • Now, Tuna is a catandcatsareanimals, so Tuna is an animal. • Becauseanyonewhokills an animal is lovedbynoone, weknowthatnoonelovesJack. • On theotherhand, Jacklovesallanimals, sosomeoneloveshim. • Sowehave a contradiction. Therefore, Curiositykilledthecat. Completeness of Resolution:

  21. RESOLUTION Thebasicstructure of theproof as follows: • First, weobservethatif S is unsatisfiable, thenthereexists a particular set of groundinstancesof theclauses of S suchthatthis set is alsounsatisfiable. • Wethenappealtothegroundresolutiontheorem, whichstatesthatpropositionalresolution is completeforgroundsentences. • Wethenuse a lifting lemmatoshowthat,foranypropositionalresolutionproofusingthe set of groundsentences, there is a correspondingfirst-orderresolutionproofusingthefirst-ordersentencesfromwhichthegroundsentenceswereobtained. Forfirst step, wewillneedthreenewconcepts: • Herbranduniverse: EXAMPLE:If S containsjusttheclause, then is thefollowinginfinite set of groundterms: • Saturation: If S is a set of clausesand P is a set of groundterms, then P(S), thesaturation of S withrespectto P, is the set of allgroundclausesobtainedbyapplyingallpossibleconsistentsubstitutions of groundterms in P withvariables in S.

  22. RESOLUTION • Herbrand Base: If S containssolelytheclausejustgiven, then is theinfinite set of clauses: Herbrand’sTheorem: If a set of clauses is unsatisfiable, thenthereexists a finitesubset of that is alsounsatisfiable. Step 2 is appliedandfor step 3: • Lifting Lemma: Itlifts a proof step fromgroundclausesupto general first-orderclauses. DealingwithEqualtiy:Therearethreedistinctapproaches. • Toaxiomatizeequality:Theequality is reflexive, symmetricandtransitive. We can substituteequalsforequals in anypredicateorfunction. Soweneedthreebasicaxioms, andthenoneforeachpredicateandfunction:

  23. RESOLUTION 2. An additionalinferencerule: • Demodulation: Foranyterms, where and is a literalcontaining z: Demodulation is typicallyusedforsimplifyingexpressionsusingcollections of assertionssuch as andso on. • Paramodulation: For anyterms, where, Unlikedemodulation, paramodulationyields a completeinferenceprocedureforfirst-orderlogicwithequality. 3. An extendedunificationalgorithm:Forexample, theterms 1+2 and 2+1 normallyare not unifiable, but a unificationalgorithmthatknowsthatcouldunifythemwiththeemptysubstitution.

  24. RESOLUTION ResolutionStrategies: • UnitPreference: Thisstrategyprefersto do resolutionswhereone of thesentences is a singleliteral (alsoknown as a unitclause). The idea behindthestrategy is thatwearetryingtoproduce an emptyclause, so it might be a good idea topreferinstancesthatproduceshorterclauses. EXAMPLE:Resolving a unitsentence (such as P) withanyothersentence (such as ) alwaysyield a clause (in thiscase, ) that is shorterthantheotherclause. • Set of Support: Itstartsbyidentifying a subset of thesentencescalledtheset of support.Everyresolutioncombines a sentencefromthe set of supportwithanothersentence, andaddstheresolventintothe set of support. • InputResolution:Here, everyresolutioncombinesone of theinputsentences withsomeothersentence. Shortly, thespace of prooftrees of thisshape is smallerthanthespace of allproofgraphs. *Thelinearresolutionstrategy is a slightgeneralizationthatallowsPandQto be resolvedtogetherifeitherP is in theoriginalKB orifP is an ancestor of Q in theprooftree. 4. Subsumption: Thesubsumptionmethodeliminatesallsentencesthataresubsumedby an existingsentence in the KB. Subsumptionhelpskeepthe KB small, andthushelpskeepthesearchspacesmall.

  25. CONCLUSION • A firstapproachusesinferencerulesforinstantiatingquantifiers in ordertopropositionalizetheinference problem. Typically, thisapproach is veryslow. • Theuse of unificationtoidentifyappropriatesubstitutionsforvariableseliminatestheinstantiation step in first-orderproofs, makingtheprocessmuchmoreefficient. • A liftedversion of ModusPonensusesunificationtoprovide a naturalandpowerfulinferencerule, generalizedModusPonens. Theforwardchainingandbackwardchainingalgorithmsapplythisruletosets of definiteclauses. • GeneralizedModusPonens is completefordefiniteclauses. ForDatalogprogramsconsisting of function-freedefiniteclauses, entailment is decidable. • Forwardchaining is used in deductivedatabases, where it can be combinedwithrelationaldatabaseoperations. It is alsoused in productionsystems, whichperformefficientupdateswithverylargerulesets.

  26. CONCLUSION • Forwardchaining is completeforDatalogprogramsandruns in polynomial time. • Backwardchaining is used in logicprogrammingsystemssuch as Prolog, whichemploysophisticatedcompilertechnologytoprovideveryfastinference. • Backwardchainingsuffersfromredundantinferencesandinfiniteloops; these can be alleviatedbymemorization. • Thegeneralizedresolutioninferenceruleprovides a completeproofsystemforfirst-orderlogic, usingKBs in conjunctive normal form. • Severalstrategiesexistforreducingthesearchspace of a resolutionsystemwithoutcompromisingcompleteness.

More Related