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

knowledge based systems knowledge based systems logic and
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Knowledge Based Systems: Knowledge Based Systems: Logic and Deduction Logic and Deduction

Course: CS40002 Course: CS40002 Instructor: Dr. Instructor: Dr. Pallab Dasgupta Pallab Dasgupta

Department of Computer Science & Engineering Department of Computer Science & Engineering Indian Institute of Technology Indian Institute of Technology Kharagpur Kharagpur

slide-2
SLIDE 2

2

CSE, IIT CSE, IIT Kharagpur Kharagpur

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
  • rder logic
  • Generalized Modus

Generalized Modus Ponens Ponens

  • Forward and backward chaining

Forward and backward chaining

  • Resolution

Resolution

  • Logical Reasoning Systems

Logical Reasoning Systems

slide-3
SLIDE 3

3

CSE, IIT CSE, IIT Kharagpur Kharagpur

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 to wumpus wumpus

  • Breeze:

Breeze: In squares adjacent to a pit In squares adjacent to a pit There can be one There can be one wumpus wumpus, one gold, and many , one gold, and many

  • pits. Agent starts from the bottom
  • pits. Agent starts from the bottom-
  • left square

left square

  • f a grid.
  • f a grid.
slide-4
SLIDE 4

4

CSE, IIT CSE, IIT Kharagpur Kharagpur

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
slide-5
SLIDE 5

5

CSE, IIT CSE, IIT Kharagpur Kharagpur

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

slide-6
SLIDE 6

6

CSE, IIT CSE, IIT Kharagpur Kharagpur

Types of Logics Types of Logics

Degree of belief Degree of belief [0..1] [0..1] Degree of truth Degree of truth Fuzzy Logic Fuzzy Logic Degree of belief Degree of belief [0..1] [0..1] Facts Facts Probability Probability Theory Theory T / F / Unknown T / F / Unknown Facts, Objects, Facts, Objects, Relations, Times Relations, Times Temporal Temporal Logic Logic T / F / Unknown T / F / Unknown Facts, Objects, Facts, Objects, Relations Relations First First-

  • Order

Order Logic Logic T / F / Unknown T / F / Unknown Facts Facts Propositional Propositional Logic Logic

Belief of agent Belief of agent Belief of agent Belief of agent What exists What exists What exists What exists Language Language Language Language

slide-7
SLIDE 7

7

CSE, IIT CSE, IIT Kharagpur Kharagpur

Propositional Propositional Logic Logic

  • Given a set of atomic propositions

Given a set of atomic propositions AP AP Sentence Sentence → → Atom | Atom | ComplexSentence ComplexSentence Atom Atom → → True | False | True | False | AP AP ComplexSentence ComplexSentence → → ( Sentence ) ( Sentence ) | Sentence Connective Sentence | Sentence Connective Sentence | | ¬ ¬ Sentence Sentence Connective Connective → → ∧ ∧ | | ∨ ∨ | | ⇔ ⇔ | | ⇒ ⇒

slide-8
SLIDE 8

8

CSE, IIT CSE, IIT Kharagpur Kharagpur

Inference Rules Inference Rules

  • Modus

Modus Ponens Ponens or Implication Elimination:

  • r Implication Elimination:
  • Unit Resolution:

β α β α , ⇒

Unit Resolution:

a β β α ¬ , ∨

slide-9
SLIDE 9

9

CSE, IIT CSE, IIT Kharagpur Kharagpur

Inference Rules Inference Rules

  • Resolution:

Resolution:

  • r
  • r

…. and several other rules …. and several other rules

γ γ β β α ∨ ∨ ¬ , ∨ a

γ γ β β α ⇒ ¬ ⇒ , ⇒ ¬ a

slide-10
SLIDE 10

10

CSE, IIT CSE, IIT Kharagpur Kharagpur

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?

slide-11
SLIDE 11

11

CSE, IIT CSE, IIT Kharagpur Kharagpur

Modeling in Modeling in propositional propositional logic logic

Propositions: Propositions: Umyth Umyth: : Unicorn in mythical Unicorn in mythical Umort Umort: : Unicorn is mortal Unicorn is mortal Umam Umam: : Unicorn is mammal Unicorn is mammal Umag Umag: : Unicorn is magical Unicorn is magical Uhorn Uhorn: : Unicorn is horned Unicorn is horned

slide-12
SLIDE 12

12

CSE, IIT CSE, IIT Kharagpur Kharagpur

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 then repeated use of Modus Ponens Ponens gives us gives us a a polytime polytime procedure. Horn sentences are of

  • procedure. Horn sentences are of

the form: the form:

P P1

1 ∧

∧ P

P2

2 ∧

∧ …

… ∧

∧ P

Pn

n ⇒

⇒ Q Q

slide-13
SLIDE 13

13

CSE, IIT CSE, IIT Kharagpur Kharagpur

First First-

  • order Logic
  • rder Logic
  • Constant

Constant → → A | 5 | A | 5 | Kolkata Kolkata | | … …

  • Variable

Variable → → a | x | s | a | x | s | … …

  • Predicate

Predicate → → Before | Before | HasColor HasColor | Raining | | Raining | … …

  • Function

Function → → Mother | Cosine | Mother | Cosine | Headoflist Headoflist | | … …

slide-14
SLIDE 14

14

CSE, IIT CSE, IIT Kharagpur Kharagpur

First First-

  • order Logic
  • rder Logic
  • Sentence

Sentence → → AtomicSentence AtomicSentence | Sentence Connective Sentence | Sentence Connective Sentence | Quantifier Variable, | Quantifier Variable, … … Sentence Sentence | | ¬ ¬ Sentence | (Sentence) Sentence | (Sentence)

  • AtomicSentence

AtomicSentence → → Predicate(Term, Predicate(Term, … …) | Term = Term ) | Term = Term

  • Term

Term → → Function(Term, Function(Term, … …) | Constant | Variable ) | Constant | Variable

  • Connective

Connective → → ⇒ ⇒ | | ∧ ∧ | | ∨ ∨ | | ⇔ ⇔

  • Quantifier

Quantifier → → ∀ ∀ | | ∃ ∃

slide-15
SLIDE 15

15

CSE, IIT CSE, IIT Kharagpur Kharagpur

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

slide-16
SLIDE 16

16

CSE, IIT CSE, IIT Kharagpur Kharagpur

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?