knowledge based systems knowledge based systems logic and
play

Knowledge Based Systems: Knowledge Based Systems: Logic and - PowerPoint PPT Presentation

Knowledge Based Systems: Knowledge Based Systems: Logic and Deduction Logic and Deduction Course: CS40002 Course: CS40002 Instructor: Dr. Pallab Dasgupta Pallab Dasgupta Instructor: Dr. Department of Computer Science & Engineering


  1. Knowledge Based Systems: Knowledge Based Systems: Logic and Deduction Logic and Deduction Course: CS40002 Course: CS40002 Instructor: Dr. Pallab Dasgupta Pallab Dasgupta Instructor: Dr. Department of Computer Science & Engineering Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Kharagpur Indian Institute of Technology

  2. Knowledge and Reasoning Knowledge and Reasoning � Representation, Reasoning and Logic Representation, Reasoning and Logic � � Propositional Propositional Logic Logic � � First First- -Order Logic Order Logic � � Inference in first Inference in first- -order logic order logic � � Generalized Modus Generalized Modus Ponens Ponens � � Forward and backward chaining Forward and backward chaining � � Resolution Resolution � � Logical Reasoning Systems Logical Reasoning Systems � CSE, IIT Kharagpur Kharagpur CSE, IIT 2

  3. The Wumpus World Environment Adjacent means left, right, top, or bottom Adjacent means left, right, top, or bottom • Stench: Stench: In squares containing and adjacent • In squares containing and adjacent to wumpus wumpus to • Breeze: Breeze: In squares adjacent to a pit In squares adjacent to a pit • There can be one wumpus wumpus, one gold, and many , one gold, and many There can be one pits. Agent starts from the bottom- -left square left square pits. Agent starts from the bottom of a grid. of a grid. CSE, IIT Kharagpur Kharagpur CSE, IIT 3

  4. The Wumpus World Environment • The agent dies if it enters a square containing a pit or the wumpus • The agent can shoot the wumpus along a straight line • The agent has only one arrow CSE, IIT Kharagpur Kharagpur CSE, IIT 4

  5. Logic Logic � A formal system for describing states of A formal system for describing states of � affairs, consisting of: affairs, consisting of: � Syntax: describes how to make sentences, and Syntax: describes how to make sentences, and � � Semantics: describes the relation between the Semantics: describes the relation between the � sentences and the states of affairs sentences and the states of affairs � A proof theory A proof theory – – a set of rules for deducing a set of rules for deducing � the entailments of a set of sentences the entailments of a set of sentences � Improper definition of logic, or an incorrect Improper definition of logic, or an incorrect � proof theory can result in absurd reasoning proof theory can result in absurd reasoning CSE, IIT Kharagpur Kharagpur CSE, IIT 5

  6. Types of Logics Types of Logics Language Language What exists What exists Belief of agent Belief of agent Language Language What exists What exists Belief of agent Belief of agent Propositional Facts T / F / Unknown Propositional Facts T / F / Unknown Logic Logic First- -Order Order Facts, Objects, T / F / Unknown First Facts, Objects, T / F / Unknown Logic Relations Logic Relations Temporal Facts, Objects, T / F / Unknown Temporal Facts, Objects, T / F / Unknown Logic Logic Relations, Times Relations, Times Probability Facts Degree of belief Probability Facts Degree of belief Theory [0..1] Theory [0..1] Fuzzy Logic Degree of truth Degree of belief Fuzzy Logic Degree of truth Degree of belief [0..1] [0..1] CSE, IIT Kharagpur Kharagpur CSE, IIT 6

  7. Propositional Logic Logic Propositional � Given a set of atomic propositions Given a set of atomic propositions AP AP � → Sentence → Atom | ComplexSentence ComplexSentence Sentence Atom | → Atom → True | False | AP Atom True | False | AP ComplexSentence → → ( Sentence ) ComplexSentence ( Sentence ) | Sentence Connective Sentence | Sentence Connective Sentence ¬ Sentence | ¬ Sentence | → ∧ | ∨ | ⇔ | ⇒ Connective → ∧ | ∨ | ⇔ | ⇒ Connective CSE, IIT Kharagpur Kharagpur CSE, IIT 7

  8. Inference Rules Inference Rules � Modus Modus Ponens Ponens or Implication Elimination: or Implication Elimination: � α ⇒ β , α β � Unit Resolution: Unit Resolution: � α ∨ β , ¬ β a CSE, IIT Kharagpur Kharagpur CSE, IIT 8

  9. Inference Rules Inference Rules � Resolution: Resolution: � α ∨ β , ¬ β ∨ γ ¬ α ⇒ β , β ⇒ γ or or ∨ γ ¬ ⇒ γ a a …. and several other rules …. and several other rules CSE, IIT Kharagpur Kharagpur CSE, IIT 9

  10. Automated Reasoning Automated Reasoning � If the unicorn is mythical, then it is immortal, If the unicorn is mythical, then it is immortal, � but if it is not mythical, then it is a mortal but if it is not mythical, then it is a mortal mammal. mammal. � If the unicorn is either immortal or a mammal, If the unicorn is either immortal or a mammal, � then it is horned. then it is horned. � The unicorn is magical if it is horned The unicorn is magical if it is horned � Can we prove that the unicorn is mythical? Can we prove that the unicorn is mythical? Magical? Horned? Magical? Horned? CSE, IIT Kharagpur Kharagpur CSE, IIT 10

  11. Modeling in propositional propositional logic logic Modeling in Propositions: Propositions: Umyth: : Unicorn in mythical Unicorn in mythical Umyth Umort: : Unicorn is mortal Unicorn is mortal Umort Umam: : Unicorn is mammal Unicorn is mammal Umam Umag: : Unicorn is magical Unicorn is magical Umag Uhorn: : Unicorn is horned Unicorn is horned Uhorn CSE, IIT Kharagpur Kharagpur CSE, IIT 11

  12. Automated Reasoning Automated Reasoning � In general, the inference problem is NP In general, the inference problem is NP- - � complete (Cook’s Theorem) complete (Cook’s Theorem) � If we restrict ourselves to Horn sentences, If we restrict ourselves to Horn sentences, � then repeated use of Modus Ponens Ponens gives us gives us then repeated use of Modus a polytime polytime procedure. Horn sentences are of procedure. Horn sentences are of a the form: the form: ∧ P ∧ … … ∧ ∧ P 1 ∧ 2 ∧ ⇒ Q n ⇒ P 1 P 2 P n Q P CSE, IIT Kharagpur Kharagpur CSE, IIT 12

  13. First- -order Logic order Logic First → Constant → � Constant � A | 5 | Kolkata Kolkata | | … … A | 5 | → Variable → � Variable � a | x | s | … … a | x | s | → Predicate → � Predicate � Before | HasColor HasColor | Raining | | Raining | … … Before | → Function → � Function � Mother | Cosine | Headoflist Headoflist | | … … Mother | Cosine | CSE, IIT Kharagpur Kharagpur CSE, IIT 13

  14. First- -order Logic order Logic First → Sentence → � Sentence AtomicSentence AtomicSentence � | Sentence Connective Sentence | Sentence Connective Sentence | Quantifier Variable, … … Sentence Sentence | Quantifier Variable, ¬ Sentence | (Sentence) | ¬ Sentence | (Sentence) | AtomicSentence → → � AtomicSentence � Predicate(Term, … …) | Term = Term ) | Term = Term Predicate(Term, → Term → � Term � Function(Term, … …) | Constant | Variable ) | Constant | Variable Function(Term, → ⇒ | ∧ | ∨ | ⇔ Connective → ⇒ | ∧ | ∨ | ⇔ � Connective � → ∀ | ∃ Quantifier → ∀ | ∃ � Quantifier � CSE, IIT Kharagpur Kharagpur CSE, IIT 14

  15. Examples Examples � Not all students take both History & Biology Not all students take both History & Biology � � Only one student failed History Only one student failed History � � Only one student failed both History & Biology Only one student failed both History & Biology � � The best score in History is better than the The best score in History is better than the � best score in Biology best score in Biology � No person likes a professor unless the No person likes a professor unless the � professor is smart professor is smart � Politicians can fool some of the people all the Politicians can fool some of the people all the � time, and they can fool all the people some of time, and they can fool all the people some of the time, but they cant fool all the people all the time, but they cant fool all the people all the time the time CSE, IIT Kharagpur Kharagpur CSE, IIT 15

  16. Examples Examples � Russel’s Russel’s Paradox: Paradox: � � There is a single barber in town. There is a single barber in town. � � Those and only those who do not shave Those and only those who do not shave � themselves are shaved by the barber. themselves are shaved by the barber. � Who shaves the barber? Who shaves the barber? � CSE, IIT Kharagpur Kharagpur CSE, IIT 16

Recommend


More recommend