1 / 30

Unification

Unification. “It is an algorithm for determining the substitutions needed to make two predicate calculus expressions match” Reference: Luger’s Book chapter 3, 2 nd edition. Implementation of Unification.  Using“List format” (PNF have already been discussed) PC Syntax List Syntax

dolph
Download Presentation

Unification

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. Unification “It is an algorithm for determining the substitutions needed to make two predicate calculus expressions match” Reference: Luger’s Book chapter 3, 2nd edition CS 331/531 Dr M M Awais

  2. Implementation of Unification  Using“List format” (PNF have already been discussed) PC SyntaxList Syntax p(a,b) (p a b) p(f(a), g(X,Y)) (p(f a)(g X Y)) p(x) ^ q(y) ((p x) ^ (q y)) CS 331/531 Dr M M Awais

  3. Unification: Examples Unify ( (parents X(father X) (mother bill)), (parents bill (father bill)Y) ). Complete Substitution {bill/X, mother (bill)/Y} CS 331/531 Dr M M Awais

  4. CS 331/531 Dr M M Awais

  5. CS 331/531 Dr M M Awais

  6. CS 331/531 Dr M M Awais

  7. Logic – Based Financial Advisor • To help a user decide whether to invest in a saving A/C or the stock market orboth CS 331/531 Dr M M Awais

  8. Policy: Saving inadequate - should invest in saving A/c regardless of income Saving adequateand adequate income- More profitable option of stock investment Low Income& adequate savings- Split surplus between saving and stock investment CS 331/531 Dr M M Awais

  9. Defining Constraints Adequate Savings/Income: Income: Rs 15,000/month extra Rs 4000/ dependent/month Saving: Rs 25,000/year extra Rs 5000/dependent/year CS 331/531 Dr M M Awais

  10. Calculating Adequacy Define Functions to calculate the minimum income and savings Minimum Savings:min_saving(X) min_saving(X)=25000+5000*X Minimum Income:min_income(X) min_income(X)=15000+4000*X where X are the number of dependents CS 331/531 Dr M M Awais

  11. Outputs Investment (savings) Investment (stocks) Investment (combination) How can we represent outputs? CS 331/531 Dr M M Awais

  12. Rules ·saving_acc (inadequate) investment (savings) ·saving_acc(adequate) ^ income(adequate) investment(stocks) ·saving_acc (adequate) ^ income (inadequate) investment (combination) CS 331/531 Dr M M Awais

  13. What next? • Define saving adequate • Define saving inadequate • Define income adequate • Define income inadequate CS 331/531 Dr M M Awais

  14. Savings Check if saved amount is greater than the minimum saving required CS 331/531 Dr M M Awais

  15. Income Check if the income is greater than the minimum income CS 331/531 Dr M M Awais

  16. Try firing rules with 9, 10, 11 CS 331/531 Dr M M Awais

  17. Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal Solution presented using alternate syntax Reference: Norviq and Russell CS 331/531 Dr M M Awais

  18. Example knowledge base contd. ... it is a crime for an American to sell weapons to hostile nations: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Nono … has some missiles, i.e., X Owns(Nono,x)  Missile(x): Owns(Nono,M1) and Missile(M1) (skolemization) … all of its missiles were sold to it by Colonel West Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missiles are weapons: Missile(x)  Weapon(x) An enemy of America counts as "hostile“: Enemy(x,America)  Hostile(x) West, who is American … American(West) The country Nono, an enemy of America … Enemy(Nono,America) CS 331/531 Dr M M Awais

  19. Example knowledge base contd. Rule Base: ... it is a crime for an American to sell weapons to hostile nations: R1: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Nono … has some missiles, i.e., R2: x Owns(Nono,x)  Missile(x) … all of its missiles were sold to it by Colonel West R3: Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missiles are weapons: R4: Missile(x)  Weapon(x) An enemy of America counts as "hostile“: R5: Enemy(x,America)  Hostile(x) • Database of Facts: • Owns(Nono,M1) ^ Missile(M1) • West, who is American … • American(West) • The country Nono, an enemy of America … • Enemy(Nono,America) CS 331/531 Dr M M Awais

  20. R1: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) R2: x Owns(Nono,x)  Mssile(x) R3: Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) R4: Missile(x)  Weapon(x) R5: Enemy(x, America)  Hostile(x) • START FROM THE FACTS • THINK WHICH RULES APPLY Be careful about the convention constants start with capital letters and variables with small (applicable to next few slides) 1. FORWARD CHAINING CS 331/531 Dr M M Awais

  21. R1: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) R2: x Owns(Nono,x)  Mssile(x) R3: Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) R4: Missile(x)  Weapon(x) R5: Enemy(x, America)  Hostile(x) R5 {Nono/x} R4 {M1/x} R3 {M1/x} CS 331/531 Dr M M Awais

  22. R1: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) R2: x Owns(Nono,x)  Mssile(x) R3: Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) R4: Missile(x)  Weapon(x) R5: Enemy(x, America)  Hostile(x) R1 {West/x , M1/y , Nono/z} CS 331/531 Dr M M Awais

  23. R1: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z) Criminal(x) R2: x Owns(Nono,x)  Mssile(x) R3: Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) R4: Missile(x)  Weapon(x) R5: Enemy(x, America)  Hostile(x) 2. BACKWARD CHAINING • START FROM THE CONCLUSION • THINK IS THE RULE SUPPORT • AVAILABLE CS 331/531 Dr M M Awais

  24. Backward chaining example West/x CS 331/531 Dr M M Awais

  25. Backward chaining example West/x CS 331/531 Dr M M Awais

  26. Backward chaining example West/x CS 331/531 Dr M M Awais

  27. Backward chaining example West/x , M1/y M1/y CS 331/531 Dr M M Awais

  28. Backward chaining example West/x , M1/y , Nono/z Nono/z M1/y CS 331/531 Dr M M Awais

  29. Backward chaining example West/x , M1/y , Nono/z Nono/z M1/y CS 331/531 Dr M M Awais

  30. Backward chaining example West/x , M1/y , Nono/z Nono/z M1/y CS 331/531 Dr M M Awais

More Related