CS6364 Lecture6 - Ch08 FOL - Rev4
CS6364 Lecture6 - Ch08 FOL - Rev4
CS 6364
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.
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)
7
Quantifiers
Relation between ∀ and ∃
∀ and ∃ are related through negation
∀x ¬ ≡ ¬ ∃x
∀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.
11
Some useful steps to convert axioms into clause
form (conversion to normal form)
Normal form
CNF – conjunctive 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))
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)
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)
_________
{y/x}
{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
(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)
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.
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)]
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.
… eliminate “”
Then what?
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)
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)
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)
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.
44
Translation in FOL
“John likes all kinds of food.”
x food(x)
x food(x) likes(John,
likes(John, x)
x)
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)
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)
48
“What food does Sue eat?”
Show that John likes peanuts.
What food does Sue eat?
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.]
+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
53
New proof
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