The unification algorithm
There is a standard algorithm that given two sentences, finds their unique most general unifying substitution.
Here are some examples of unification.
Knows(John, x) = Likes(John, x)
Knows(John, Jane)
Knows(y, Leonid)
Knows(y, Mother(y))
The unification algorithm whould give the following results:
UNIFY(Knows(John,x), Knows(John,Jane)) = {x/Jane}
UNIFY(Knows(John,x), Knows(y,Leonid)) = {x/Leonid, y/John}
The substitution makes the two sentences identical.
UNIFY(Knows(John,x), Knows(y,Mother(y))) = {x/John, x/Mother(John)}
Notice that the substitutions always involve a variable and a ground term.
UNIFY(Knows(John,x), Knows(x,Elizabeth)) = fail
The variable x cannot have two values at the same time, so this last example fails.
Another example that would always fail is
UNIFY(x, F(x)) = fail
This fails because a the variable may never occur in the term it is being unified with.
Horn clauses
Generalized modus ponens requires sentences to be in a standard form, called Horn clauses after the mathematician Alfred Horn.
A Horn clause is a sentence of the form
q1 AND q2 AND ... AND qn -> r
where each qi and r is an atomic sentence and all variables are universally quantified.
Recall that an atomic sentence is a just single predicate and does not allow negation.
Normally the universal quantifiers are implicit (not written explicitly).
To refresh your memory, here is the syntax of FOL in Backus-Naur form.
Sentence -> AtomicSentence
| Sentence Connective Sentence
| Quantifier Variable,... Sentence
| NOT Sentence
| (Sentence)
AtomicSentence -> Predicate(Term, ...) | Term = Term
Term -> Constant
| Variable
| Function(Term,...)
Connective -> AND | OR | => | <=>
Quantifier -> FORALL | EXISTS
Constant -> A | X_1 | John | ...
Variable -> a | x | s ...
Predicate -> Before | HasColor | Raining | ...
Function -> Smelly | LeftLegOf | Plus | ...
In order to obtain Horn clauses, existential quantifiers must be eliminated using Skolemization.
Example:
EXISTS x Loves(John,x) AND Loves(x,John)
becomes
Loves(John,personx)
Loves(personx,John)
Note that above we have two Horn clauses, which share a Skolem constant.
Backward chaining
The backward chaining algorithm can answer questions in Horn clause knowledge bases.
It works by taking the goal and checking to see if it unifies directly with a sentence in the database.
If so, it returns the substitution list that makes the query equal the known sentence.
Otherwise, backward chaining finds all the implications whose conclusions unify with the query and then tries to establish their premises.
Consider a knowledge base that says it is illegal to sell weapons to hostile nations. It also says that Colonel West sold all of country Nono's missiles to it. And missiles are weapons.
American(x) AND Weapon(y) AND Nation(z) AND Hostile(z)
AND Sells(x,y,z) => Criminal(x)
Owns(Nono, x) AND Missile(x) => Sells(West,Nono,x)
Missile(x) => Weapon(x)
Enemy(x,America) => Hostile(x)
We add to it the following facts:
American(West)
Nation(Nono)
Enemy(Nono, America)
Missile(M1)
We want to solve the crime: Is West a criminal?
0 comments:
Post a Comment