0% found this document useful (0 votes)
6 views55 pages

CS6364 Lecture6 - Ch08 FOL - Rev4

The document discusses First Order Logic (FOL) and its components, including syntax, semantics, and quantifiers, emphasizing the need for variables to represent properties of objects. It also covers the process of resolution theorem proving, detailing how to convert axioms into clause form and use resolution to derive contradictions. The document concludes with examples of proof using resolution and the concept of refutation in logical reasoning.

Uploaded by

Erhan Tiryaki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views55 pages

CS6364 Lecture6 - Ch08 FOL - Rev4

The document discusses First Order Logic (FOL) and its components, including syntax, semantics, and quantifiers, emphasizing the need for variables to represent properties of objects. It also covers the process of resolution theorem proving, detailing how to convert axioms into clause form and use resolution to derive contradictions. The document concludes with examples of proof using resolution and the concept of refutation in logical reasoning.

Uploaded by

Erhan Tiryaki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 55

Artificial Intelligence

CS 6364

Lecture 6 (AI Chapter 8)


First Order Logic and
Resolution
First Order Logic
(First Order Predicate Calculus)
 There is need to access components of a sentence.
 Looking at a sentence as in Prepositional logic is too
coarse.
 We need to deal with objects, their properties and
functions of objects that may combine in various ways.
We say that Prepositional logic has a very limited ontology.
 There is need to have variables. We want to be able to
refer to a set of objects as having some property and avoid
to indicate that each member of the set has that property.

Objects: cats, student, house


Relation: brother of, sister of
Properties: fat, red, cold
Functions: father of, best friend

2
Syntax and Semantics of FOL
Sentence: represents a fact (as in prepositional logic).
Constant symbols: A, B, John, Dallas,
refer to real objects.
Predicates: Round, Brother,
refer to relations between objects and functions of objects.
Round (Ball)
Term is a logical expression that refers to an object.
LeftLegOf (John).
Atomic sentences: a sentence that is formed from a
predicate followed by a list of term
Brother (John, Mary).
Atomic sentences with complex terms:
Married (Father of (John), Mother of (Mary))

3
Syntax and Semantics of FOL
An atomic sentence is true if the relation defined by predicate
is true for the arguments.
Complex sentences—use connectives to link atomic
sentences.
Brother (John, Mary) ∧ Brother (John, Richard)
says that John is brother of Mary and Richard.

Older (John, 30) ∨ Younger (John, 30)


Older (John, 30) ⇒ ¬Younger (John, 30)
¬Brother (Sue, John)

4
Quantifiers
There is need to express properties of sets rather than
enumerating the same property for all members of the set.
Universal quantifier ∀
Indicates that a sentence is true for all values of its variables.
All cats are mammals. Is logically equivalent to:
If x is a cat than x is mammal.
∀ x Cat(x) ⇒ Mammal(x)
This replaces a large number of relations for all the cats in the
world.
Cat(Spot) ⇒ Mammal(Spot) ∧
Cat(Felix) ⇒ Mammal(Felix) ∧ ...
∀ is universal quantifier because the logical expression
Cat ⇒ Mammal
is true for all cats in the universe.
5
Quantifiers
Existential quantifier ∃
Indicates that a sentence is true for some values in the
domain.
Spot has a sister who is a cat.
∃ x Sister(x, Spot) ∧ Cat(x)
Is equivalent to
(Sister (Bibi, Spot) ∧ Cat(Bibi)) ∨
(Sister (Felix, Spot) ∧ Cat(Felix)) ∨
(Sister (Rebecca, Spot) ∧ Cat(Rebecca))...

Note that
⇒ is used with ∀
∧ is used with ∃
Think why.
6
Quantifiers

Nested quantifiers
∀xy is equivalent to ∀x∀y
∀xy Parent(x,y) ⇒ child(y,x)

Everybody loves somebody


∀x∃y Loves(x,y)

There is someone who is loved by everyone


∃y∀x Loves(x,y)

7
Quantifiers
Relation between ∀ and ∃
∀ and ∃ are related through negation

Nobody likes taxes


∀x ¬Likes(x,Taxes)
≡ (is equivalent to)
¬∃x Likes(x,Taxes)

∀x ¬ ≡ ¬ ∃x

Everybody likes Ice cream


∀x Likes (x, Ice cream) ≡ ¬∃x ¬Likes (x,Ice cream)

∀x ≡ ¬∃x ¬
8
Quantifiers
Some Equivalent Sentences
¬∃x p(x) ≡ ∀x ¬p(x)
¬∀x p(x) ≡ ∃x ¬p(x)
∃x p(x) ≡ ∃y p(y)
∀x q(x) ≡ ∀y q(y)
∀x (p(x) ∧ q(x)) ≡ ∀x p(x) ∧ ∀y q(y)
∃x (p(x) ∨ q(x)) ≡ ∃x p(x) ∨ ∃y q(y)

Note:
First order logic allows quantified variables to refer to objects
in the discourse and not to predicates
[We can state something about whether there exists x such
that p(x) is true or not. But we cannot talk about whether
there exists p such that p(x) is true or not.]
9
Resolution Theorem Proving
Resolution finds contradictions in a KB of clauses.
Resolution is a sound inference rule.
Resolution refutation proves a theorem by negating the
statement to be proved and adding this negated goal to the
set of axioms.
Refutation is complete, meaning that always we get empty
clause if exists. Thus resolution refutation is sound and
complete.

Steps (for Resolution Refutation Proofs)


1. Put the premises or axioms into clause form. All axioms are
expressed as disjunction of literals.
2. Add the negation of what is to be proved, in clause
form, to the set of axioms.
3. Resolve these clauses together producing new clauses that
follow logically from them.
4. Produce a contradiction by generating the empty clause.
10
Some useful steps to convert axioms into clause
form (conversion to normal form)
 Eliminate implications
P ⇒ Q ≡ ¬P ∨ Q
 Move negations down to atomic formulas
¬(P ∧ Q) ≡ (¬P) ∨ (¬Q)
¬(P ∨ Q) ≡ (¬P) ∧ (¬Q)
¬∀x(P(x)) ≡ ∃x(¬P(x))
¬∃x(P(x)) ≡ ∀x(¬P(x))
 Rename variables as necessary so that no two variables are the
same.
∀x P(x) ≡ ∀y P(y)
(∀xP(x)) ∨ (∃x Q(x)) ≡ (∀x P(x)) ∨ (∃y Q(y))
 Move quantifiers left
P ∨ (∀xQ(x)) ≡ ∀x [P ∨ Q(x)]
 Eliminate existential quantifiers.
(called Skolemization)
a) ∃x P(x) replaced by P(A) where A is a constant.

11
Some useful steps to convert axioms into clause
form (conversion to normal form)
 Normal form
 CNF – conjunctive normal form
(… v … v …) ^ (…) ^ … ^ (… )

DNF – disjunctive normal form


(… ^ … ^ … ) V (… ) V (… )

12
Some useful steps to convert axioms into clause
form (conversion to normal form [CNF])
 Eliminate existential quantifiers.
(called Skolemization)
a) ∃x P(x) replaced by P(A) where A is a constant.
b) ∃y∀x P(x,y) replaced by ∀xP(x,A)
c) ∀x∃y P(x,y) replaced by ∀xP(x,f(x))
where f(x) is a Skolem function (that is, y=f(x))
Case c) requires more discussion. Variable y cannot be replaced by a
constant.
Example: “Everyone has a heart”.
∀x Person(x) ⇒ ∃y Heart(y) ∧ Has(x,y)
If we replaced y by a constant A we have
∀x Person(x) ⇒ Heart(A) ∧ Has(x,A)
This means that everyone has the same heart A (or sharing one heart
A), which is not true. Instead we replace y with f(x), meaning that a heart
y is linked by x by f(X).
∀x Person(x) ⇒ Heart(f(x)) ∧ Has(x,f(x))

Skolemization eliminates existentially quantified variables so we can drop


universal quantifiers.
13
Some useful steps to convert axioms into clause
form (conversion to normal form)
 Move disjunctions down to literals
P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R)

 Eliminate conjunctions
(P(x) ∨ Q(x)) ∧ (R(x) ∨ S(x))
Is decomposed into two clauses
a) P(x) ∨ Q(x)
b) R(x) ∨ S(x)

In fact we do not eliminate conjunctions, we only write


differently.

 Eliminate universal quantifiers.


We do not actually eliminate but instead we consider that all
variables are universally quantified.
∀x P(x) becomes P(x)

14
Logical Proof with Modus Ponens
Resolution produces a proof similar to the one produced by
modus ponens.
Example:
Natural Language Predicate form Clause form
1. All dogs are animals.: ∀x(dog(x) ⇒ animal(x)) ¬dog(x) ∨ animal(x)
2. Fido is a dog.: dog(fido) dog(fido)
3. All animals will die. ∀y(animal(y) ⇒ die(y)) ¬animal(y) ∨ die(y)
_________

We wish to prove that “Fido will die”: die(fido)


Proof with modus ponens: (use predictae form)
1 and 2: modus ponens & unify fido with x
→ animal(fido)
3 and animal(fido) via modus ponens and unify
{fido/y} → die(fido)
We proved that “fido will die” using modus ponens.
15
Proof with resolution
Step 1. Transform axioms into clause form.
Step 2. Add negation ¬die(fido)
Step 3. Resolve these clauses together
¬dog(x)∨animal(x) ¬animal(y)∨die(y) ¬dog(y) ∨ animal(y)
{y/x}
{y/x} ¬animal(y) ∨ die(y)
----------------
dog(fido) ¬dog(y)∨die(y) ¬dog(y) ∨ die(y)

{fido/y} ¬dog(fido) ∨ die(fido)


¬die(fido) dog(fido)
die(fido)
----------------
null die(fido)

If dog(fido) then die(fido)


Note: From substitutions we determine more information: Since dog(fido)
Therefore die(fido)
fido/y meaning fido is an animal
The process of reading back the unifications is called answer extraction.
16
Proof with resolution
Step 1. Transform axioms into clause form.
Step 2. Add negation ¬die(fido)
Step 3. Resolve these clauses together
¬dog(x)∨animal(x) ¬animal(y)∨die(y) ¬dog(y) ∨ animal(y)
{y/x}
{y/x} ¬animal(y) ∨ die(y)
----------------
dog(fido) ¬dog(y)∨die(y) ¬dog(y) ∨ die(y)

{fido/y} ¬dog(fido) ∨ die(fido)


¬die(fido) dog(fido)
die(fido)
----------------
null die(fido)

If dog(fido) then die(fido)


Note: From substitutions we determine more information: Since dog(fido)
Therefore die(fido)
fido/y meaning fido is an animal
The process of reading back the unifications is called answer extraction.
17
Proof with resolution
Step 1. Transform axioms into clause form.
Step 2. Add negation ¬die(fido)
Step 3. Resolve these clauses together
¬dog(x)∨animal(x) ¬animal(y)∨die(y)

{y/x}

dog(fido) ¬dog(y)∨die(y) ¬dog(fido) ∨ die(fido)


dog(fido)
{fido/y} ----------------
die(fido) ¬die(fido) die(fido)

null If dog(fido) then die(fido)


Since dog(fido)
Therefore die(fido)
Note: From substitutions we determine more information:
fido/y meaning fido is an animal
The process of reading back the unifications is called answer extraction.
18
Proof with resolution
Step 1. Transform axioms into clause form.
Step 2. Add negation ¬die(fido) ¬dog(fido) ∨ die(fido)
dog(fido)
Step 3. Resolve these clauses together ----------------
¬dog(x)∨animal(x) ¬animal(y)∨die(y) die(fido)

{y/x} If dog(fido) then die(fido)


Since dog(fido)
dog(fido) ¬dog(y)∨die(y) Therefore die(fido)

{fido/y}
die(fido) ¬die(fido) ¬die(fido)  die(fido)
----------------
null
Contradiction

Therefore the negated goal (¬die(fido) ) must be false. Thus the goal (die(fido)) is
true.
Note: From substitutions we determine more information: fido/y meaning fido is an
animal. The process of reading back the unifications is called answer extraction. 19
Proof with resolution (in summary)
Step 1. Transform axioms into clause form.
Step 2. Add negation ¬die(fido)
Step 3. Resolve these clauses together
¬dog(x)∨animal(x) ¬animal(y)∨die(y)
¬dog(fido) ∨ die(fido)
{y/x}
dog(fido)
¬dog(y)∨die(y) ----------------
dog(fido)
die(fido)
{fido/y}
If dog(fido) then die(fido)
die(fido) ¬die(fido)
Since dog(fido)
Therefore die(fido)
null

Note: From substitutions we determine more information:


fido/y meaning fido is an animal
The process of reading back the unifications is called answer extraction.
20
Refutation
 Definition
Definition -- one
one complete
complete inference
inference procedure
procedure using
using resolution!
resolution!
also
also known
known as
as -- proof
proof by
by contradiction
contradiction
-- reductio
reductio ad
ad absurdum
absurdum
The
The idea:
idea:
to
to prove
prove P,
P,
assume
assume P P is
is false
false (i.e. add P
(i.e. add P to
to KB)
KB) and
and
prove
prove by
by contradiction
contradiction

(KB  P
(KB P  False) 
 False) (KB 
 (KB  P)
P)

21
Example Proof
 Refutation
Refutation on
on aa more
more complex
complex example:
example:

 In
In English:
English:

Everyone
Everyone who
who loves
loves all
all animals
animals is
is loved
loved by
by someone.
someone.

Anyone
Anyone who
who kills
kills an
an animal
animal is
is loved
loved by
by no
no one.
one.

Jack
Jack loves
loves all
all animals.
animals.

Either
Either Jack
Jack or
or Curiosity
Curiosity killed
killed the
the cat
cat who
who is
is named
named Tuna.
Tuna.

=>
=> Did
Did Curiosity
Curiosity kill
kill the
the cat?
cat?

22
Translation in FOL (AI 3e Ch9 p.346-349)
A.
A. Everyone
Everyone who
who loves
loves all
all animals
animals is
is loved
loved by
by someone.
someone.
B.
B. Anyone
Anyone who
who kills
kills an
an animal
animal isis loved
loved by
by no
no one.
one.
C.
C. Jack
Jack loves
loves all
all animals.
animals.
D&E.
D&E. Either
Either Jack
Jack or
or Curiosity
Curiosity killed
killed the
the cat
cat who
who is
is named Tuna..
named Tuna
FF Cat
Cat is
is animal.
animal.
G.
G. Did
Did Curiosity
Curiosity kill
kill the
the cat?
cat?

A.
A. x
x [y Animal(y) 
[y Animal(y)  Loves(x, y)] 
Loves(x, y)]  [y
[y Loves(y,
Loves(y, x)]
x)]
(Note
(Note the
the scope
scope of
of the
the first
first yy and
and
the
the second
second y)
y)
B.
B. x
x [y Animal(y)  Kills(x,y)]
[y Animal(y) Kills(x,y)]  [z Loves(z,x)]
 [z Loves(z,x)]
C.
C. x Animal(x) 
x Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F.
F. x Cat(x) 
x Cat(x)  Animal(x)
Animal(x)

G.
G. Kills(Curiosity,
Kills(Curiosity, Tuna)
Tuna) 23
Conversion to CNF (AI 3e p.346-349)
A. x
A. x [[ y Animal(y) 
y Animal(y)  Loves(x, y) ]] 
Loves(x, y)  [[ y
y Loves(y,
Loves(y, x)
x) ]]

 Eliminate
Eliminate Implications
Implications
x [[
x  [[ y
y [ Animal(y)  Loves(x,
[ Animal(y) y)] ]] ]]  [y
Loves(x, y)] [y Loves(y,
Loves(y, x)] x)]
 Move  inwards
 Move inwards
x [ yy  (
x [ Animal(y)  Loves(x,
( Animal(y) y) )) ]]  [y
Loves(x, y) [y Loves(y,
Loves(y, x)] x)]
x
x [
[ yy ( Animal(y)   Loves(x,
( Animal(y) Loves(x, y)y) )) ]]  [y
[y Loves(y,
Loves(y, x)] x)]
x
x [ Animal(y)   Loves(x,
[ yy Animal(y) y)]  [y
Loves(x, y)] [y Loves(y,
Loves(y, x)] x)]
 Standardize

Standardize Variables
Variables
x
x [ Animal(y)   Loves(x,
[ yy Animal(y) y)]  [z
Loves(x, y)] [z Loves(z,
Loves(z, x)] x)]
 Skolemize

Skolemize (remove
(remove existential
existential quantifier;
quantifier; FF && G G areare Skolem
Skolem functions
functions of
of x)
x)
x [Animal(F(x))   Loves(x,
x [Animal(F(x)) F(x))]  Loves(G(z),
Loves(x, F(x))] Loves(G(z), x) x)
Note
Note (p.346).
(p.346). IfIf we make: x
we make: x [ Animal(y)   Loves(x,
[ yy Animal(y) Loves(x, y)] y)]  [z
[z Loves(z,
Loves(z, x)]
x)]
to be: x
to be: [Animal(A)   Loves(x,
x [Animal(A) Loves(x, A)] A)]  Loves(B,
Loves(B, x) x)
or: x
or: [Animal(F(x))   Loves(x,
x [Animal(F(x)) Loves(x, F(x))]F(x))]  Loves(G(x),
Loves(G(x), x)x)
This
This means:
means: everyone
everyone either
either (a)
(a) fails
fails to
to love
love aa particular
particular animal
animal F(x)
F(x) or
or (b)
(b) is
is loved
loved by
by aa person
person
G(x).
G(x). [And
[And xx can
can be
be true
true for
for both
both cases].
cases]. The The intent
intent of
of the
the original
original statement
statement (“Everyone
(“Everyone whowho loves
loves
all animals is loved by someone.” ) is missed (as being too inclusive). This
all animals is loved by someone.” ) is missed (as being too inclusive). This person who does not person who does not
love
love aa particular
particular animal
animal isis also
also loved
loved by by someone
someone (that
(that is,
is, because
because of of it).
it). Q:
Q: Is
Is G(z)
G(z) or
or zz
depending
depending on on aa particular
particular xx or
or not?
not? Or Or the
the choice
choice isis zz for
for one
one who
who loves
loves anyone
anyone who who loves
loves all
24
all
Conversion to CNF (AI 3e p.346-349)
A. x
A. x [[ y Animal(y) 
y Animal(y)  Loves(x, y) ]] 
Loves(x, y)  [y
[y Loves(y,
Loves(y, x)]
x)]

 Eliminate
Eliminate Implications
Implications
x [ [[ y
x [ y [ Animal(y)  Loves(x,
[ Animal(y) y)] ]] ]]  [y
Loves(x, y)] [y Loves(y,
Loves(y, x)]x)]

 Move  inwards
Move inwards
x [ yy  (
x [ Animal(y)  Loves(x,
( Animal(y) y))]  [y
Loves(x, y))] [y Loves(y,
Loves(y, x)]
x)]
x [ yy 
x [ Animal(y)   Loves(x,
 Animal(y) y))]  [y
Loves(x, y))] [y Loves(y,
Loves(y, x)]
x)]
x
x [ Animal(y)   Loves(x,
[ yy Animal(y) y)]  [y
Loves(x, y)] [y Loves(y,
Loves(y, x)]
x)]

 Standardize
Standardize Variables
Variables
x
x [ Animal(y)   Loves(x,
[ yy Animal(y) y)]  [z
Loves(x, y)] [z Loves(z,
Loves(z, x)]
x)]

 Skolemize
Skolemize (remove
(remove existential
existential quantifier;
quantifier; FF && G G are
are Skolem
Skolem functions
functions of
of x)
x)
x [Animal(F(x))   Loves(x,
x [Animal(F(x)) F(x))]  Loves(G(x),
Loves(x, F(x))] Loves(G(x), x)
x)

 Drop
Drop universal
universal quantifier
quantifier
[Animal(F(x))   Loves(x,
[Animal(F(x)) F(x))]  Loves(G(x),
Loves(x, F(x))] Loves(G(x), x)
x)
Distribute  over
 Distribute
 over 
[Animal(F(x))  Loves(G(x),
[Animal(F(x)) x)]  [
Loves(G(x), x)] [ Loves(x, F(x))]  Loves(G(x),
Loves(x, F(x))] Loves(G(x), x)]
x)]
Thus
Thus we
we have:
have:
A1 [Animal(F(x))  Loves(G(x),
A1 [Animal(F(x)) Loves(G(x), x)]
x)] 25
A2 [ Loves(x, F(x))]  Loves(G(x), x)]
Conversion to CNF (AI 3e p.346-349)
A.
A. x
x [y Animal(y) 
[y Animal(y)  Loves(x,
Loves(x, y)]y)] 
 [y
[y Loves(y,
Loves(y, x)]
x)]
B.
B. x
x [y Animal(y)  Kills(x,y)]
[y Animal(y) Kills(x,y)]  [z Loves(z,x)]
 [z Loves(z,x)]
C. x
C. Animal(x) 
x Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D. Kills(Jack,
D. Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F. x
F. Cat(x) 
x Cat(x)  Animal(x)
Animal(x)
G.
G. Kills(Curiosity,
Kills(Curiosity, Tuna)
Tuna)

A1. Animal(F(x))  Loves(G(x),


A1. Animal(F(x)) Loves(G(x), x) x)
A2. Loves(x,
A2. F(x))  Loves(G(x),
Loves(x, F(x)) Loves(G(x), x) x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F. Cat(x)
F. Cat(x)  Animal(x)
Animal(x)
G.
G. Kills(Curiosity,
Kills(Curiosity, Tuna)
Tuna)
26
Proof (AI 3e p.346-349)
A1.Animal(F(x))  Loves(G(x),
A1.Animal(F(x)) Loves(G(x), x) x)
A2.Loves(x, F(x))  Loves(G(x),
A2.Loves(x, F(x)) Loves(G(x), x)
x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F.
F. Cat(x)
Cat(x)  Animal(x)
Animal(x)
G.Kills(Curiosity,
G.Kills(Curiosity, Tuna)
Tuna)

R1: EE && FF 
R1:  Animal(Tuna)
Animal(Tuna) {Tuna/x}
{Tuna/x}
R2: R1&B 
R2: R1&B  Loves(y,
Loves(y, x)x)  Kills(x,
Kills(x, Tuna)
Tuna) {Tuna/z}
{Tuna/z}
R3:
R3: DD && G
G  Kills(Jack,
Kills(Jack, Tuna)
Tuna)
R4:
R4: R3 R2 
R3 && R2  Loves(y,
Loves(y, Jack)
Jack)
R5:
R5: A2
A2 && CC  Animal(F(Jack))
Animal(F(Jack))  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x, F(x) == }
{Jack/x, F(x) }
R6:
R6: R5 A1 
R5 && A1  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x}
{Jack/x}
R7:
R7: R4 R6 
R4 && R6  FALSE
FALSE {G(Jack)/y}
{G(Jack)/y} **
** Contradiction
Contradiction **
** 27
Proof (AI 3e p.346-349)
A1.Animal(F(x))  Loves(G(x),
A1.Animal(F(x)) Loves(G(x), x) x)
A2.Loves(x, F(x))  Loves(G(x),
A2.Loves(x, F(x)) Loves(G(x), x)
x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F.
F. Cat(x)
Cat(x)  Animal(x)
Animal(x)
G.Kills(Curiosity,
G.Kills(Curiosity, Tuna)
Tuna)

R1: EE && FF 
R1:  Animal(Tuna)
Animal(Tuna) {Tuna/x}
{Tuna/x}
R2: R1&B 
R2: R1&B  Loves(y,
Loves(y, x)x)  Kills(x,
Kills(x, Tuna)
Tuna) {Tuna/z}
{Tuna/z}
R3:
R3: DD && G
G  Kills(Jack,
Kills(Jack, Tuna)
Tuna)
R4:
R4: R3 R2 
R3 && R2  Loves(y,
Loves(y, Jack)
Jack)
R5:
R5: A2
A2 && CC  Animal(F(Jack))
Animal(F(Jack))  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x, F(x) == }
{Jack/x, F(x) }
R6:
R6: R5 A1 
R5 && A1  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x}
{Jack/x}
R7:
R7: R4 R6 
R4 && R6  FALSE
FALSE {G(Jack)/y}
{G(Jack)/y} **
** Contradiction
Contradiction **
** 28
Proof (AI 3e p.346-349)
A1.Animal(F(x))  Loves(G(x),
A1.Animal(F(x)) Loves(G(x), x) x)
A2.Loves(x, F(x))  Loves(G(x),
A2.Loves(x, F(x)) Loves(G(x), x)
x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F.
F. Cat(x)
Cat(x)  Animal(x)
Animal(x)
G.Kills(Curiosity,
G.Kills(Curiosity, Tuna)
Tuna)

R1: EE && FF 
R1:  Animal(Tuna)
Animal(Tuna) {Tuna/x}
{Tuna/x}
R2: R1&B 
R2: R1&B  Loves(y,
Loves(y, x)x)  Kills(x,
Kills(x, Tuna)
Tuna) {Tuna/z}
{Tuna/z}
R3:
R3: DD && G
G  Kills(Jack,
Kills(Jack, Tuna)
Tuna)
R4:
R4: R3 R2 
R3 && R2  Loves(y,
Loves(y, Jack)
Jack)
R5:
R5: A2
A2 && CC  Animal(F(Jack))
Animal(F(Jack))  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x, F(x) == }
{Jack/x, F(x) }
R6:
R6: R5 A1 
R5 && A1  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x}
{Jack/x}
R7:
R7: R4 R6 
R4 && R6  FALSE
FALSE {G(Jack)/y}
{G(Jack)/y} **
** Contradiction
Contradiction **
** 29
Proof (AI 3e p.346-349)
A1.Animal(F(x))  Loves(G(x),
A1.Animal(F(x)) Loves(G(x), x) x)
A2.Loves(x, F(x))  Loves(G(x),
A2.Loves(x, F(x)) Loves(G(x), x)
x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F.
F. Cat(x)
Cat(x)  Animal(x)
Animal(x)
G.Kills(Curiosity,
G.Kills(Curiosity, Tuna)
Tuna)

R1: EE && FF 
R1:  Animal(Tuna)
Animal(Tuna) {Tuna/x}
{Tuna/x}
R2: R1&B 
R2: R1&B  Loves(y,
Loves(y, x)x)  Kills(x,
Kills(x, Tuna)
Tuna) {Tuna/z}
{Tuna/z}
R3:
R3: DD && G
G  Kills(Jack,
Kills(Jack, Tuna)
Tuna)
R4:
R4: R3 R2 
R3 && R2  Loves(y,
Loves(y, Jack)
Jack)
R5:
R5: A2
A2 && CC  Animal(F(Jack))
Animal(F(Jack))  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x, F(x) == }
{Jack/x, F(x) }
R6:
R6: R5 A1 
R5 && A1  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x}
{Jack/x}
R7:
R7: R4 R6 
R4 && R6  FALSE
FALSE {G(Jack)/y}
{G(Jack)/y} **
** Contradiction
Contradiction **
** 30
Proof (AI 3e p.346-349)
A1.Animal(F(x))  Loves(G(x),
A1.Animal(F(x)) Loves(G(x), x) x)
A2.Loves(x, F(x))  Loves(G(x),
A2.Loves(x, F(x)) Loves(G(x), x)
x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F.
F. Cat(x)
Cat(x)  Animal(x)
Animal(x)
G.Kills(Curiosity,
G.Kills(Curiosity, Tuna)
Tuna)

R1: EE && FF 
R1:  Animal(Tuna)
Animal(Tuna) {Tuna/x}
{Tuna/x}
R2: R1&B 
R2: R1&B  Loves(y,
Loves(y, x)x)  Kills(x,
Kills(x, Tuna)
Tuna) {Tuna/z}
{Tuna/z}
R3:
R3: DD && G
G  Kills(Jack,
Kills(Jack, Tuna)
Tuna)
R4:
R4: R3 R2 
R3 && R2  Loves(y,
Loves(y, Jack)
Jack)
R5:
R5: A2
A2 && CC  Animal(F(Jack))
Animal(F(Jack))  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x, F(x) == }
{Jack/x, F(x) }
R6:
R6: R5 A1 
R5 && A1  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x}
{Jack/x}
R7:
R7: R4 R6 
R4 && R6  FALSE
FALSE {G(Jack)/y}
{G(Jack)/y} **
** Contradiction
Contradiction **
** 31
Proof (AI 3e p.346-349)
A1.Animal(F(x))  Loves(G(x),
A1.Animal(F(x)) Loves(G(x), x) x)
A2.Loves(x, F(x))  Loves(G(x),
A2.Loves(x, F(x)) Loves(G(x), x)
x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F.
F. Cat(x)
Cat(x)  Animal(x)
Animal(x)
G.Kills(Curiosity,
G.Kills(Curiosity, Tuna)
Tuna)

R1: EE && FF 
R1:  Animal(Tuna)
Animal(Tuna) {Tuna/x}
{Tuna/x}
R2: R1&B 
R2: R1&B  Loves(y,
Loves(y, x)x)  Kills(x,
Kills(x, Tuna)
Tuna) {Tuna/z}
{Tuna/z}
R3:
R3: DD && G
G  Kills(Jack,
Kills(Jack, Tuna)
Tuna)
R4:
R4: R3 R2 
R3 && R2  Loves(y,
Loves(y, Jack)
Jack)
R5:
R5: A2
A2 && CC  Animal(F(Jack))
Animal(F(Jack))  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x, F(x) == }
{Jack/x, F(x) }
R6:
R6: R5 A1 
R5 && A1  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x}
{Jack/x}
R7:
R7: R4 R6 
R4 && R6  FALSE
FALSE {G(Jack)/y}
{G(Jack)/y} **
** Contradiction
Contradiction **
** 32
Proof (AI 3e p.346-349)
A1.Animal(F(x))  Loves(G(x),
A1.Animal(F(x)) Loves(G(x), x) x)
A2.Loves(x, F(x))  Loves(G(x),
A2.Loves(x, F(x)) Loves(G(x), x)
x)
B. Animal(y)
B. Animal(y)  Kills(x,y)
Kills(x,y)  Loves(z,x)]
Loves(z,x)]
C. Animal(x)
C. Animal(x)  Loves(Jack,
Loves(Jack, x) x)
D.
D. Kills(Jack, Tuna)  Kills(Curiosity,
Kills(Jack, Tuna) Kills(Curiosity, Tuna)
Tuna)
E.
E. Cat(Tuna)
Cat(Tuna)
F. Cat(x)
F. Cat(x)  Animal(x)
Animal(x)
G.Kills(Curiosity,
G.Kills(Curiosity, Tuna)
Tuna)

R1: EE && FF 
R1:  Animal(Tuna)
Animal(Tuna) {Tuna/x}
{Tuna/x}
R2: R1&B 
R2: R1&B  Loves(y,
Loves(y, x)x)  Kills(x,
Kills(x, Tuna)
Tuna) {Tuna/z}
{Tuna/z}
R3:
R3: DD && G
G  Kills(Jack,
Kills(Jack, Tuna)
Tuna)
R4:
R4: R3 R2 
R3 && R2  Loves(y,
Loves(y, Jack)
Jack)
R5:
R5: A2
A2 && CC  Animal(F(Jack))
Animal(F(Jack))  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x, F(x) == }
{Jack/x, F(x) }
R6:
R6: R5 A1 
R5 && A1  Loves(G(Jack),
Loves(G(Jack), Jack)
Jack) {Jack/x}
{Jack/x}
R7:
R7: R4 R6 
R4 && R6  FALSE
FALSE {G(Jack)/y}
{G(Jack)/y} **
** Contradiction
Contradiction **
** 33
Resolution Proof (AI 3e p.346-349)

34
Example 2
In English:
The custom officials searched everyone who entered the country and
was not a VIP. Some of the drug pushers entered this country and
they were only searched by drug pushers. No drug pusher was a VIP.

At least one of the custom officials was a drug pusher.

35
Translation in FOL
“The custom officials searched everyone who entered the country and
was not a VIP”

x
x y (entered_country(x)  VIP(x))
y (entered_country(x) VIP(x))  (official(y)  searched(y,x))
 (official(y) searched(y,x))

with
with VIP(x)
VIP(x) -- xx is
is aa VIP
VIP

official(y)
official(y) -- yy is
is aa custom
custom official
official
searched(x,y)
searched(x,y) xx has has searched
searched yy

“Some of the drug pushers entered this country and they were only
searched by drug pushers”
x
x y [entered_country(x)  d_pusher(x)]
y [entered_country(x) d_pusher(x)]  [searched(y,x)
[searched(y,x) 
 d_pusher(y)]
d_pusher(y)]

36
More translations!
“No drug pusher was a VIP”

x [d_pusher(x) 
x [d_pusher(x)   VIP(x)]
VIP(x)]

Goal: “At least one of the custom officials is a drug pusher”

x (official(x)  d_pusher(x))
x (official(x) d_pusher(x))

37
More details
Let
Let us
us look
look again
again at
at the
the translation
translation
“The custom officials searched everyone who entered the country and
was not a VIP”

x
x y
y VIP(x)) 
(entered_country(x)  VIP(x))
(entered_country(x)  (official(y)
(official(y)  searched(y,x))
searched(y,x))
Eliminate “”

x y ((
x y (entered_country(x) VIP(x))  (official(
(entered_country(x)  VIP(x)) (official(yy))  searched(
searched(yy,x))
,x))

x VIP(x)  (official(
(entered_country(x)  VIP(x)
x (entered_country(x) official(f(x) searched(f(x)
f(x)))  searched( ,x))
f(x),x)

Skolem function
1. entered_country(x)  VIP(x)  official(f(x))
2. entered_country(x)  VIP(x)  searched(f(x),x) 38
The axioms
Some of the drug pushers entered this country and they were only searched by
drug pushers.

x y [entered_country(x)  d_pusher(x)]  [searched(y, x) 


d_pusher(y)]

… eliminate “”

x y [entered_country(x)  d_pusher(x)]  [ searched(y,x) 


d_pusher(y)]

Then what?

x=a (a constant) + standardize variables yx

3. entered_country(a)

4. d_pusher(a)

5. searched(x,a)  d_pusher(x)
39
Last axioms
From statement x (d_pusher(x)  VIP(x))

6. d_pusher(x)  VIP(x)

The goal: x (official(x)  d_pusher(x))

Negated: x (official(x)  d_pusher(x))

7. official(x)  d_pusher(x)

40
The refutation
2: entered_country(x)  VIP(x)  searched(f(x),x)
6. d_pusher(x)  VIP(x)

8: d_pusher(x)  entered_country(x)  searched(f(x),x)

4. d_pusher(a)

a/x
9: entered_country(a)  searched(f(a),a)

3. entered_country(a)

10: searched(f(a),a)

41
The refutation
1: entered_country(x)  VIP(x)  official(f(x))

6. d_pusher(x)  VIP(x)

11: d_pusher(x)  entered_country(x)  official(f(x))

4. d_pusher(a)

a/x
a/x
12: entered_country(a)  official(f(a))

3. entered_country(a)

13: official(f(a))

42
The refutation
5. searched(x,a)  d_pusher(x)

10. searched(f(a),a)
x/f(a)
14: d_pusher(f(a))

7. ¬official(x)  ¬d_pusher(x)
x/f(a)
15: ¬official(f(a))

13: official(f(a))

NIL
NIL
The
The statement
statement is
is valid.
valid.

43
Example 3
John likes all kinds of food.
Apple is food.
Chicken is food.
Anything anyone eats isn’t killed by is food.
Bill eats peanuts and is alive.
Sue eats anything Bill eats.

Show that John likes peanuts.


What food does Sue eat?

44
Translation in FOL
“John likes all kinds of food.”
x food(x) 
x food(x)  likes(John,
likes(John, x)
x)

“Apple is food.” food(Apple)


food(Apple)

“Chicken is food.” food(Chicken)


food(Chicken)

“Anything anyone eats isn’t killed by is food.”


x y (eats(x,y)
x y (eats(x,y)   killed(x,y))  food(y)
killed(x,y))  food(y)

45
More translations
“Bill eats peanuts and is alive.”

II assume
assume
alive(x)
alive(x)  y (killed(x,y))
 y (killed(x,y))

is
is too
too general
general for
for the
the context
context of
of the
the sentence
sentence

II prefer
prefer the
the conversion:
conversion:

eats(Bill,Peanuts)
eats(Bill,Peanuts)   killed(Bill,
killed(Bill, Peanuts)
Peanuts)

II could
could have
have used:
used:
eats(Bill,Peanuts)
eats(Bill,Peanuts)  x killed(Bill, x)
x killed(Bill, x)

“Sue eats anything Bill eats.”

x eats(Bill,x)
x  eats(Sue,x)
eats(Bill,x)  eats(Sue,x)
46
Refute “John likes peanuts”

Transformation to CNF:
1. food(x)  likes(John, x)
2. food(Apple)
3. food(Chicken)
4. eats(x,y)  killed(x,y))  food(y)
5. eats(Bill, Peanuts)
6. killed(Bill, Peanuts)
7. eats(Bill,x)  eats(Sue,x)

+Goal: 8. likes(John,Peanuts)

47
The proof
9. food(Peanuts) from 1&8 Peanuts/x
Transformation to CNF:
1. food(x)  likes(John, x)
10. killed(Bill, Peanuts)  food(Peanuts)
2. food(Apple)
from 4&5 Bill/x 3. food(Chicken)
4. eats(x,y)  killed(x,y))  food(y)
Peanuts/y
11. food(Peanuts) 6&10 5. eats(Bill, Peanuts)
6. killed(Bill, Peanuts)
7. eats(Bill,x)  eats(Sue,x)
12. NIL 9&11
+Goal: 8. likes(John,Peanuts)

This resolution theorem proving showed that the clause


 “John likes peanuts” is valid

48
“What food does Sue eat?”
Show that John likes peanuts.
What food does Sue eat?

We do again theorem proving, changing the goal clause to:

likes(John, Peanuts)  eats(Sue, z)

That is, if John likes peanuts, then Sue does not eat z. (negated
Goal)
[Or to show whether Sue does eat peanuts for peanuts are one of
food.]

One instance of food is peanuts.


Note. food(z) where z could be … from
food(peanuts)
food(apple)
food(chicken)
49
Axioms
1. food(x)  likes(John, x) Transformation to CNF:
2. food(Apple) 1. food(x)  likes(John, x)
2. food(Apple)
3. food(Chicken)
3. food(Chicken)
4. eats(x,y)  killed(x,y)  food(y) 4. eats(x,y)  killed(x,y))  food(y)
5. eats(Bill, Peanuts) 5. eats(Bill, Peanuts)
6. killed(Bill, x) 6. killed(Bill, Peanuts)
7. eats(Bill,x)  eats(Sue,x) 7. eats(Bill,x)  eats(Sue,x)

+Goal: 8.

Goal
8. likes(John,Peanuts)  eats(Sue,z)

50
Proof
9. food(Peanuts)  eats(Sue,z)
from 1&8 Peanuts/x Transformation to CNF:
1. food(x)  likes(John, x)
10. eats(Sue, Peanuts) 2. food(Apple)
from 5&7 Peanuts/x 3. food(Chicken)
4. eats(x,y)  killed(x,y))  food(y)
11. food(Peanuts) 5. eats(Bill, Peanuts)
from 9&10 z/Peanuts6. killed(Bill, Peanuts)
7. eats(Bill,x)  eats(Sue,x)
12. killed(Bill, Peanuts)  food(Peanuts)
from 4&5 Billy/x 8.likes(John,Peanuts)eats(Sue,z)
Peanuts/y

13. food(Peanuts) from 6&12 x/Peanuts

14. NIL from 11&13

From the substitution in 11, we see that z=Peanuts  Sue eats


51
Peanuts
Another proof
9. food(Peanuts)  eats(Sue,z)
from 1&8 Peanuts/x
10. killed(Bill, Peanuts)  food(Peanuts)
from 4&5 Billy/x
Peanuts/y
11. food(Peanuts) from 6&10 x/Peanuts
12. eats(Sue, z) from 9&11
13. eats(Sue, Peanuts) from 5&7 Peanuts/x
14. NIL from 12&13 Peanuts/z
Transformation to CNF:
1. food(x)  likes(John, x)
2. food(Apple)
 that is Sue eats
Peanuts
3. food(Chicken)
4. eats(x,y)  killed(x,y))  food(y)
5. eats(Bill, Peanuts)
6. killed(Bill, Peanuts)
eats(Sue, Peanuts)
7. eats(Bill,x)  eats(Sue,x)
8.likes(John,Peanuts)eats(Sue,z)
52
Answering questions

“What food does Sue eat?”


Set the goal to:

8′. x (eats(Sue,x)  eats(Sue,x))


[ If eats(Sue, x) then
eats(Sue, x) ]

53
New proof

9. eats(Bill,Peanuts)  eats(Sue, Peanuts)


from 7&8
Peanuts/x

10. eats(Sue, Peanuts) from 5&9

54
Lessons learned
 4
4 examples
examples
 Several
Several kinds
kinds of
of proofs
proofs
 Formal
Formal method
method of
of answering
answering questions
questions
 Search
Search and
and unification
unification

55

You might also like