Professional Documents
Culture Documents
Existential Instantiation:
Given x, likes(x, McDonalds)
Infer likes(S1, McDonalds)
S1 is a Skolem Constant that is not found
anywhere else in the KB and refers to (one of)
the indviduals that likes McDonalds.
March 14, 2006 AI: Chapter 9: Inference in 4
First-Order Logic
Universal Instantiation
Every instantiation of a universally quantified
sentence is entailed by it:
Example:
x King(x) Greedy(x) Evil(x) yields
King(John) Greedy(John) Evil(John)
King(Richard) Greedy(Richard) Evil(Richard)
King(Father(John)) Greedy(Father(John) Evil(Father(John))
Example:
x Crown(x) OnHead(x, John) yields:
Crown(C1) OnHead(C1, John)
provided C1 is a new constant (Skolem)
March 14, 2006 AI: Chapter 9: Inference in 6
First-Order Logic
Existential Instantiation
UI can be applied several times to
add new sentences
The KB is logically equivalent to the old
Problems:
May generate infinite sentences when it
cannot prove
Will generate many irrelevant sentences
along the way!
March 14, 2006 AI: Chapter 9: Inference in 8
First-Order Logic
Reduction to Propositional
Inference
Suppose the KB had the following
sentence
x King(x) Greedy(x) Evil(x)
King(John)
Greedy(John)
Brother(Richard, John)
In Lisp
(cons (unify (car list1) (car list2))
(unify (cdr list1) (cdr list2))
If (goal clear <x>) AND (on <y> <x>) AND (clear <y>) THEN
add (clear <x>) add (on <y> table) delete (on <y> <x>)
JOIN
report rule 1
is satisfied
JOIN
JOIN report rule 5
JOIN report rule 2 is satisfied
report rule 3 is satisfied JOIN
is satisfied report rule 4
is satisfied
Important commands
(assert fact) (deffacts fact1 fact2 )
(defrule rule-name rule)
(reset) - eliminates all facts except initial-fact
(load file) (load-facts file)
(run)
(watch all)
(exit)
(defrule putting-on
?g <- (goal put-on ?x ?y)
(clear ?x)
?bottomclear <- (clear ?y)
==>
(assert (on ?x ?y))
(retract ?g)
(retract ?bottomclear)
)
March 14, 2006 AI: Chapter 9: Inference in 40
First-Order Logic
Backward Chaining
Consider the item to be proven a goal
Find a rule whose head is the goal (and
bindings)
Apply bindings to the body, and prove
these (subgoals) in turn
If you prove all the subgoals, increasing
the binding set as you go, you will prove
the item.
Logic Programming (cprolog, on CS)
March 14, 2006 AI: Chapter 9: Inference in 41
First-Order Logic
Backward Chaining Example
Facts
January, clouds
Prove
snow
March 14, 2006 AI: Chapter 9: Inference in 61
First-Order Logic
Propositional Resolution
Example
snow cold precipitation snow
January cold
cold precipitation
clouds clouds