Professional Documents
Culture Documents
Chapter 9
Chapter 9
Outline
Reducing first-order inference to propositional inference
Unification
Generalized Modus Ponens
Forward and backward chaining
Logic programming
Resolution
Chapter 9
Stoics
Aristotle
Cardano
Boole
Frege
Wittgenstein
Godel
Herbrand
Godel
Davis/Putnam
Robinson
Chapter 9
Chapter 9
Chapter 9
Chapter 9
Reduction contd.
Claim: a ground sentence is entailed by new KB iff entailed by original KB
Claim: every FOL KB can be propositionalized so as to preserve entailment
Idea: propositionalize KB and query, apply resolution, return result
Problem: with function symbols, there are infinitely many ground terms,
e.g., F ather(F ather(F ather(John)))
Theorem: Herbrand (1930). If a sentence is entailed by an FOL KB,
it is entailed by a finite subset of the propositional KB
Idea: For n = 0 to do
create a propositional KB by instantiating with depth-n terms
see if is entailed by this KB
Problem: works if is entailed, loops if is not entailed
Theorem: Turing (1936), Church (1936), entailment in FOL is semidecidable
Chapter 9
Chapter 9
Unification
We can get the inference immediately if we can find a substitution
such that King(x) and Greedy(x) match King(John) and Greedy(y)
= {x/John, y/John} works
Unify(, ) = if =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, Jane)
Knows(y, OJ)
Knows(y, M other(y))
Knows(x, OJ)
Chapter 9
10
Unification
We can get the inference immediately if we can find a substitution
such that King(x) and Greedy(x) match King(John) and Greedy(y)
= {x/John, y/John} works
Unify(, ) = if =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
Chapter 9
11
Unification
We can get the inference immediately if we can find a substitution
such that King(x) and Greedy(x) match King(John) and Greedy(y)
= {x/John, y/John} works
Unify(, ) = if =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
Chapter 9
12
Unification
We can get the inference immediately if we can find a substitution
such that King(x) and Greedy(x) match King(John) and Greedy(y)
= {x/John, y/John} works
Unify(, ) = if =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
q
Knows(John, Jane)
Knows(y, OJ)
Knows(y, M other(y))
Knows(x, OJ)
{x/Jane}
{x/OJ, y/John}
{y/John, x/M other(John)}
Chapter 9
13
Unification
We can get the inference immediately if we can find a substitution
such that King(x) and Greedy(x) match King(John) and Greedy(y)
= {x/John, y/John} works
Unify(, ) = if =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
q
Knows(John, Jane)
Knows(y, OJ)
Knows(y, M other(y))
Knows(x, OJ)
{x/Jane}
{x/OJ, y/John}
{y/John, x/M other(John)}
f ail
Chapter 9
14
p1 is King(x)
p10 is King(John)
p2 is Greedy(x)
p20 is Greedy(y)
is {x/John, y/John} q is Evil(x)
q is Evil(John)
GMP used with KB of definite clauses (exactly one positive literal)
All variables assumed universally quantified
Chapter 9
15
Soundness of GMP
Need to show that
p10, . . . , pn0, (p1 . . . pn q) |= q
provided that pi0 = pi for all i
Lemma: For any definite clause p, we have p |= p by UI
1. (p1 . . . pn q) |= (p1 . . . pn q) = (p1 . . . pn q)
2. p10, . . . , pn0 |= p10 . . . pn0 |= p10 . . . pn0
3. From 1 and 2, q follows by ordinary Modus Ponens
Chapter 9
16
Chapter 9
17
Chapter 9
18
Chapter 9
19
Chapter 9
20
Chapter 9
21
Chapter 9
22
Chapter 9
23
Chapter 9
24
American(West)
Missile(M1)
Owns(Nono,M1)
Enemy(Nono,America)
Chapter 9
25
Weapon(M1)
American(West)
Missile(M1)
Sells(West,M1,Nono)
Owns(Nono,M1)
Hostile(Nono)
Enemy(Nono,America)
Chapter 9
26
Weapon(M1)
American(West)
Missile(M1)
Sells(West,M1,Nono)
Owns(Nono,M1)
Hostile(Nono)
Enemy(Nono,America)
Chapter 9
27
Chapter 9
28
Chapter 9
29
NT
Q
WA
SA
NSW
Victoria
Chapter 9
30
Chapter 9
31
Chapter 9
32
American(x)
Weapon(y)
Sells(x,y,z)
{x/West}
Hostile(z)
Chapter 9
33
American(West)
Weapon(y)
Sells(x,y,z)
{x/West}
Hostile(z)
{}
Chapter 9
34
American(West)
Weapon(y)
Sells(x,y,z)
Sells(West,M1,z)
{x/West}
Hostile(Nono)
Hostile(z)
{}
Missile(y)
Chapter 9
35
American(West)
Weapon(y)
Sells(x,y,z)
Sells(West,M1,z)
{x/West, y/M1}
Hostile(Nono)
Hostile(z)
{}
Missile(y)
{ y/M1 }
Chapter 9
36
Criminal(West)
American(West)
Weapon(y)
Sells(West,M1,z)
Hostile(z)
{ z/Nono }
{}
Missile(y)
Missile(M1)
Owns(Nono,M1)
{ y/M1 }
Chapter 9
37
Criminal(West)
American(West)
Weapon(y)
Hostile(Nono)
Sells(West,M1,z)
{ z/Nono }
{}
Missile(y)
Missile(M1)
Owns(Nono,M1)
Enemy(Nono,America)
{ y/M1 }
{}
{}
{}
Chapter 9
38
Chapter 9
39
Logic programming
Sound bite: computation as inference on logical KBs
1.
2.
3.
4.
5.
6.
7.
Logic programming
Ordinary programming
Identify problem
Identify problem
Assemble information
Assemble information
Tea break
Figure out solution
Encode information in KB
Program solution
Encode problem instance as facts Encode problem instance as data
Ask queries
Apply program to data
Find false facts
Debug procedural errors
Chapter 9
40
Prolog systems
Basis: backward chaining with Horn clauses + bells & whistles
Widely used in Europe, Japan (basis of 5th Generation project)
Compilation techniques approaching a billion LIPS
Program = set of clauses = head :- literal1, . . . literaln.
criminal(X) :- american(X), weapon(Y), sells(X,Y,Z), hostile(Z).
Chapter 9
41
Prolog examples
Depth-first search from a start state X:
dfs(X) :- goal(X).
dfs(X) :- successor(X,S),dfs(S).
No need to loop over S: successor succeeds for each
Appending two lists to produce a third:
append([],Y,Y).
append([X|L],Y,[X|Z]) :- append(L,Y,Z).
query:
append(A,B,[1,2]) ?
answers: A=[]
B=[1,2]
A=[1]
B=[2]
A=[1,2] B=[]
Chapter 9
42
Chapter 9
43
Conversion to CNF
Everyone who loves all animals is loved by someone:
x [ y Animal(y) Loves(x, y)] [ y Loves(y, x)]
1. Eliminate biconditionals and implications
x [ y Animal(y) Loves(x, y)] [ y Loves(y, x)]
2. Move inwards: x, p x p, x, p x p:
x [ y (Animal(y) Loves(x, y))] [ y Loves(y, x)]
x [ y Animal(y) Loves(x, y)] [ y Loves(y, x)]
x [ y Animal(y) Loves(x, y)] [ y Loves(y, x)]
Chapter 9
44
Chapter 9
45
Hostile(z)
L
L
L
L
L
L
L
L
L
>
>
Hostile(z)
Hostile(z)
Hostile(z)
>
Enemy(Nono,America)
Owns(Nono,M1)
>
Hostile(x)
>
Enemy(x,America)
Owns(Nono,M1)
>
Owns(Nono,M1)
Missile(M1)
Sells(West,y,z)
Sells(West,M1,z)
>
Missile(M1)
Criminal(West)
Sells(West,y,z)
Sells(West,y,z)
>
Sells(West,x,Nono)
>
Owns(Nono,x)
>
>
Missile(x)
Missile(y)
>
Missile(M1)
Weapon(y)
Weapon(y)
>
Weapon(x)
>
Missile(x)
American(West)
>
American(West)
Criminal(x)
Hostile(z)
>
Sells(x,y,z)
>
Weapon(y)
>
American(x)
>
Hostile(Nono)
Hostile(Nono)
Hostile(Nono)
Enemy(Nono,America)
Chapter 9
46