Artificial Intelligence: Inference in First-Order Logic
Artificial Intelligence: Inference in First-Order Logic
Artificial Intelligence: Inference in First-Order Logic
UI versus EI
From xy (y + x = y) we obtain
y+a=y
From x y (y + x = y) we obtain
y+e=y
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). That is,
= {x/John, y/John} works
U NIFY (, ) =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
if =
Knows(John, Jane)
Knows(y, OJ)
Knows(y, M other(y))
Knows(x, OJ)
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). That is,
= {x/John, y/John} works
U NIFY (, ) =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
if =
Knows(John, Jane)
{x/Jane}
Knows(y, OJ)
Knows(y, M other(y))
Knows(x, OJ)
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). That is,
= {x/John, y/John} works
U NIFY (, ) =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
if =
Knows(John, Jane)
{x/Jane}
Knows(y, OJ)
{x/OJ, y/John}
Knows(y, M other(y))
Knows(x, OJ)
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). That is,
= {x/John, y/John} works
U NIFY (, ) =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
if =
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(Jo
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). That is,
= {x/John, y/John} works.
U NIFY (, ) =
p
Knows(John, x)
Knows(John, x)
Knows(John, x)
Knows(John, x)
if =
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(Jo
f ail
Conversion to CNF
Everyone who loves all animals is loved by someone:
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)]
6. Distribute over :
where pi 0 = pi
p1 is King(x)
p1 0 is King(John)
p2 is Greedy(x)
p2 0 is Greedy(y)
is {x/John, y/John} q is Evil(x)
q is Evil(John)
Soundness of GMP
Need to show that
p1 0 , . . . , pn 0 , (p1 . . . pn q) |= q
Resolution
Full first-order version:
`1 ` k ,
m1 m n
(`1 `i1 `i+1 `k m1 mj1 mj+1 m
with = {x/Ken}.
Soundness of Resolution
Need to show `1 `k ,
m1 mn |= c where c is
(`1 `i1 `i+1 `k m1 mj1 mj+1 mn )
and U NIFY (`i , mj ) = .
This is true because
1. `1 `k |= (`1 `k ) by UI,
2. m1 mn |= (m1 mn ) by UI, and
3. (`1 `k ) and (m1 mn ) imply c by
propositional resolution.
Using Resolution
1. Obtain CN F (KB )
2. Apply resolution steps to the CNF
3. If the empty clause is generated, then KB |= .
Hostile(z)
Hostile(Nono)
Hostile(Nono)
L
L
L
L
L
L
L
L
L
>
Enemy(Nono,America)
>
Hostile(Nono)
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)
>
Logic programming
Sound bite: computation as inference on logical KBs
Logic programming
Ordinary programming
1.
Identify problem
Identify problem
2.
Assemble information
Assemble information
3.
Tea break
4.
Encode information in KB
Program solution
5.
6.
Ask queries
7.
Prolog Systems
A resolution inference system on Horn clauses + bells & whistles
Widely used in Europe, Japan (basis of 5th Generation project)
Compilation techniques 60 million LIPS
Program = set of definite clauses, which are of form:
head :- literal1 , . . . literaln .
weapon(X) :- missile(X).
Prolog Examples
Depth-first search from a start state X:
dfs(X) :- goal(X).
dfs(X) :- successor(X,S),dfs(S).