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 First- 4
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)
• Problems:
– May generate infinite sentences when it
cannot prove
– Will generate many irrelevant sentences along
the way!
• 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 First- 40
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)
• Facts
– January, clouds
• Prove
– snow
¬clouds clouds