Docsity

First-Order Logic: Knowledge Representation in Predicate Logic, Slides of Introduction to Computing

Partial preview of the text

Download First-Order Logic: Knowledge Representation in Predicate Logic and more Slides Introduction to Computing in PDF only on Docsity!

CS613 INTRODUCTION TO

ARTIFICIAL INTELLIGENCE

Lecture 10

Knowledge Representation

First-Order Logic

Knowledge Representation

A number of knowledge-representation techniques have been devised:

  • Rules
  • First-Order Logic
  • Semantic nets
  • Frames
  • etc

Logic: a classic example

  1. All men are mortal
  2. Socrates is a man

therefore

  1. Socrates is mortal
  • Statements (1) and (2) are called axioms. They are assumed to be correct.
  • Statement (3) is called a theorem that logically follows from the axioms
  • This is an example of deductive inference , which means obtaining specific facts from general rules
  • Deductive inference is truth-preserving
  • Obtaining general rules from specific facts is called inductive inference.
  • Inductive inference is NOT truth preserving
  • Example (very simple) :
    1. Robins are birds and they can fly
    2. Parrots are birds and they can fly
    3. Finches are birds and they can fly
    4. Eagles are birds and they can fly 5.... 6....

therefore

  1. All birds can fly

Note: people are often very good at generalizing

  • In predicate calculus notation...
    1. x [ is_a_man(x)is_mortal(x) ] 2. is_a_man(Socrates) 3. is_mortal(Socrates)
  • predicates :
    • is_a_man(x) "x is a man "
    • is_mortal(x) "x is mortal "
  • new symbols:
    • x universal quantification "for all values of variable x ... “
    •  implication
    • AB "A implies B" “ if A, then B“

Modus ponens

  • Consider E1E

E1 therefore E

  • modus ponens is the inference operation

(or rule) that produces E2 from E1 and EE

  • x [ is_a_man(x)is_mortal(x) ]
  • is_a_man(Socrates)is_mortal(Socrates)
  • is_a_man(Socrates)
  • is_mortal(Socrates)

Predicate calculus

fundamentals

  • terms
    • constants
    • variables
    • functions
  • predicates
  • atomic formulas
  • literals
  • Well-Formed Formulas (wff)

Terms

  • constant symbols (also called objects), Eg., Socrates, NOMAD, box
  • variable symbols, Eg., x, y, person
  • functions (with arguments), Eg., hair_color(John)

(returns brown, blond , etc.)

  • Terms serve as arguments to predicates

Atomic formulas

  • An atomic formula is one predicate with its arguments
  • is_a_man(Socrates)

"Socrates is a man"

  • are_friends(Calvin, Hobbes)

"Calvin and Hobbes are friends"

  • on(B, A)

"Block B is on top of block A"

  • is_dentist(sister(John))

"John's sister is a dentist“

  • In Prolog

friends(calvin, bobbes).

Literals

  • A literal is an atomic formula or a negated

atomic formula

  • "Joan is at home"

is_at_home(Joan)

  • "Simmons is not at home"

¬ is_at_home(Simmons)

  • Negation: ¬ (not)
    • Truth table: (let F1 be any atomic formula)

F1 ¬ F

T F

F T

  • Disjunction : V | + "or"
    • "Jack plays guitar or Jill sings (or both)" plays_guitar (Jack) V sings (Jill)
    • Truth table:

F1 F2 F1 V F

F F F

F T T

T F T

T T T

  • Implication :  "implies"
    • "If the groundhog sees its shadow, then there will be 6 more weeks of winter" see_shadow (ghog)duration (winter, 6)
    • Truth table:

F1 F2 F1  F

F F T

F T T

T F F

T T T

  • Notice that ( F1F2) has the same truth table as ( ¬ F1 V F2)
  • Either expression can be replaced by the other at

any time

  • Represent such equivalence as

( F1F2 )( ¬ F1 V F2 )

F1 F2 F1  F

F F T

F T T

T F F

T T T

¬ F1 F2^ ¬ F1^ VF

T F T

T T T

F F F

F T T

Equivalence laws

F1 Λ F 2  F 2 Λ F 1

F1 V F2  F2 V F

F1 Λ (F 2 Λ F 3 )  (F 1 Λ F 2 ) Λ F 3

F1 V (F2 V F3)  (F1 V F2) V F

F1 Λ (F 2 V F 3 )  (F 1 Λ F 2 ) V (F 1 Λ F 3 )

F1 V (F2 Λ F 3 )  (F 1 V F 2 ) Λ (F 1 V F 3 )

¬ (¬ F1)  F

¬(F1 V F2)  ¬ F1 Λ ¬ F 2