08 Predicate Logic II
08 Predicate Logic II
∃v α
Subst({v/k}, α)
Crown(C1) ∧ OnHead(C1,John)
Idea: For n = 0 to ∞ do
create a propositional KB by instantiating with depth-$n$ terms
see if α is entailed by this KB
• E.g., from:
θ = {x/John,y/John} works
• Unify(α,β) = θ if αθ = βθ
p q θ
Knows(John,x) Knows(John,Jane)
Knows(John,x) Knows(y,OJ)
Knows(John,x) Knows(y,Mother(y))
Knows(John,x) Knows(x,OJ)
θ = {x/John,y/John} works
• Unify(α,β) = θ if αθ = βθ
p q θ
Knows(John,x) Knows(John,Jane) {x/Jane}
Knows(John,x) Knows(y,OJ)
Knows(John,x) Knows(y,Mother(y))
Knows(John,x) Knows(x,OJ)
θ = {x/John,y/John} works
• Unify(α,β) = θ if αθ = βθ
p q θ
Knows(John,x) Knows(John,Jane) {x/Jane}
Knows(John,x) Knows(y,OJ) {x/OJ,y/John}
Knows(John,x) Knows(y,Mother(y))
Knows(John,x) Knows(x,OJ)
• Unify(α,β) = θ if αθ = βθ
p q θ
Knows(John,x) Knows(John,Jane) {x/Jane}}
Knows(John,x) Knows(y,OJ) {x/OJ,y/John}}
Knows(John,x) Knows(y,Mother(y)) {y/John,x/Mother(John)}}
Knows(John,x) Knows(x,OJ)
θ = {x/John,y/John} works
• Unify(α,β) = θ if αθ = βθ
p q θ
Knows(John,x) Knows(John,Jane) {x/Jane}
Knows(John,x) Knows(y,OJ) {x/OJ,y/John}
Knows(John,x) Knows(y,Mother(y)) {y/John,x/Mother(John)}
Knows(John,x) Knows(x,OJ) {fail}
Missile(x) ⇒ Weapon(x)
An enemy of America counts as "hostile“:
Enemy(x,America) ⇒ Hostile(x)
West, who is American …
American(West)
The country Nono, an enemy of America …
Enemy(Nono,America)
Forward chaining algorithm
Forward chaining proof
Forward chaining proof
Enemy(x,America) ⇒ Hostile(x)
Missile(x) ∧ Owns(Nono,x) ⇒ Sells(West,x,Nono)
Missile(x) ⇒ Weapon(x)
Forward chaining proof
append([],Y,Y).
append([X|L],Y,[X|Z]) :- append(L,Y,Z).
• query: append(A,B,[1,2]) ?
A=[1] B=[2]
A=[1,2] B=[]
Resolution: brief summary
• Full first-order version:
(l1 ∨ ··· ∨ li-1 ∨ li+1 ∨ ··· ∨ lk ∨ m1 ∨ ··· ∨ mj-1 ∨ mj+1 ∨ ··· ∨ mn)θ
where Unify(li, ¬mj) = θ.
• The two clauses are assumed to be standardized apart so that they share no
variables.
• For example,
¬Rich(x) ∨ Unhappy(x)
Rich(Ken)
Unhappy(Ken)
with θ = {x/Ken}
6. Distribute ∨ over ∧ :
Missile(x) ⇒ Weapon(x)
An enemy of America counts as "hostile“:
Enemy(x,America) ⇒ Hostile(x)
West, who is American …
American(West)
The country Nono, an enemy of America …
Enemy(Nono,America)
Resolution proof: definite clauses
Converting to clause form
Prove I(A,27)
Example: Resolution
Refutation Prove I(A,27)
Example: Answer Extraction