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
- All men are mortal
- Socrates is a man
therefore
- 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) :
- Robins are birds and they can fly
- Parrots are birds and they can fly
- Finches are birds and they can fly
- Eagles are birds and they can fly 5.... 6....
therefore
- All birds can fly
Note: people are often very good at generalizing
- In predicate calculus notation...
- 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
- A B "A implies B" “ if A, then B“
Modus ponens
E1 therefore E
- modus ponens is the inference operation
(or rule) that produces E2 from E1 and E E
- 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"
"Block B is on top of block A"
"John's sister is a dentist“
friends(calvin, bobbes).
Literals
- A literal is an atomic formula or a negated
atomic formula
is_at_home(Joan)
¬ 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 ( F1 F2) has the same truth table as ( ¬ F1 V F2)
- Either expression can be replaced by the other at
any time
- Represent such equivalence as
( F1 F2 ) ( ¬ 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