Notes on Resolution from last day

advertisement
Resolution.
Resolution theorem proving works by showing the negation of the theorem, to be proved
cannot be true. This is called proof by refutation.
To use resolution, the axioms involved in the proof must be expressed in a logic form
called clause form. Logic sentences in clause form contain no quantifiers, implications or
conjunctions.
Clause 1:Not(Hairy(X)) Or Dog(X)
is an example of a sentence in clause form.
Resolution theorem proving works by producing resolvents.
Two clauses can be resolved to produce a new clause(i.e. its resolvent), if one clause
contains the negation of a predicate in the other formula.
The resolvent consists of those literals in both clauses less the opposing literals.
The following clause
Clause 2: Hairy(X)
could be resolved with Clause 1. to produce the resolvent Dog(X).
It might be that two literals are not quite direct opposites but only can be matched by
appropriate substitutions. Finding appropriate substitutions is called unification and the
substitution is called a unifier.
For example, if clause 2 were Hairy(Y) then it could only be resolved with clause 1
using the unifier {Y / X} i.e. Y substituted by X.
To illustrate Resolution theorem proving we use clause 1 and and the latter version of
clause 2, i.e. Hairy(Y).
The theorem we want to prove is that X is a dog, i.e. Dog(X). So we negate this clause
to produce clause 3, Not(Dog(X)).
Resolving clause 1 and clause 2 using the unifier {Y/ X} we get clause 4, Dog(X).
Adding this and clause 3 to the set of clauses we get:
Clause 1:Not(Hairy(X)) Or Dog(X).
Clause 2:Hairy(Y).
Clause 3:Not(Dog(X).
Clause 4: Dog(X).
Now, all these clauses are supposed to be true but we have a contradiction between clause
3 and clause 4, so the refutation of the theorem, i.e. clause 3 is inconsistent with the
original set of clauses. Therefore we can assume the theorem to be proved.
Laws of Logic
  X f(X) ==  X(  f (X)
  X f(X) ==  X(  f (X)
 X f(X) ===  Yf(Y)
 X f(X) ==  Y f(Y)
 X (p(X)  q(X)) ===  X(p(X)   Yq(Y))
 X (p(X)  q(X)) ===  X (p(X)   Yq(Y))
Skolemization
Dropping the  existential quantifier.
We can do this in two ways via a skolem constant and a skolem function.
Consider
 X dog(X).
We can just give the dog that exists a name, say rover and replace the above
expression with
dog(rover)
rover is called a skolem constant
 X  Y f(X,Y) with a function of X instead of Y
We can replace the above with
 X f(X,f1(X))
f1(X) is a skolem function
Example
1  X  Y mother(X,Y) Everybody has a mother. Can be replaced by
2  X mother(X,m(X)) where m(X) is a skolem function which returns the mother of
X
Similarly we can replace expressions of the form
Convert the following expression to clause form.
 X( f (X)   Y( m(X,Y)))   X  Z((a(X,Z)  b(X,Z))  c(Z,3))
Reduce 
 X(  f (X)   Y( m(X,Y)))   X  Z((a(X,Z)  b(X,Z))  c(Z,3))
Negation locally scoped so next get rid of 
 X(  f (X)  ( m(X,q(X))))   X  Z((a(X,Z)  b(X,Z))  c(Z,3))
Change universally quantified names
 X(  f (X)  ( m(X,q(X))))   W  Z((a(W,Z)  b(W,Z))  c(Z,3))
Move quantifiers to the left
 X  W  Z (  f (X)  ( m(X,q(X))))  ((a(W,Z)  b(W,Z))  c(Z,3))
Drop quantifiers
(  f (X)  ( m(X,q(X))))  ((a(W,Z)  b(W,Z))  c(Z,3))
Conjunts of disjuncts so three clauses
(  f (X)  ( m(X,q(X))))
((a(W,Z)  b(W,Z))
c(Z,3))
Finally make variable names unique in each clause.
(  f (X)  ( m(X,q(X))))
((a(W,Z)  b(W,Z))
c(Z1,3))
4:
a)
Outline an algorithm for performing unification
Function Unify(E1, E2);
begin
case
both E1 and E2 are constants or the empty list
if E1 = E2 then return {} else return FAIL
E1 is a variable: if E1 occurs in E2 then return FAIL
else return {E2/E1};
E2 is a variable: if E2 occurs in E1 then return FAIL
else return {E1/E2};
otherwise
begin
HE1:= head of E1
HE2:= head of E2
SUBS1 = UNIFY(HE1,HE2);
IF SUBS1 = FAIL THEN RETURN FAIL;
TE1 := APPLY( SUBS1, REST OF E1)
TE2 := APPLY( SUBS1, REST OF E2)
SUBS2:= UNIFY(TE1,TE2);
IF SUBS2 = FAIL THEN RETURN FAIL; ELSE RETURN THE COMPOSITION OF SUBS1 AND
SUBS2.
END
end end.
Using the algorithm presented in part a), unify the following pairs of expressions
i)
password( mary, favourite(Y,X)) with password(X, favourite(toy,f(X))
Fails because eventually mary and f(mary) which cannot be unified are invalidly
matched.
ii) p(X,a,Y) with p(Z,Z,b)
{X/Z, a/X,bY}
iii) story(X, m(X), Y, Z) with story(baby_bear, Y1, d(X), goldilocks)
{{ baby_bear/X, m(baby_bear)/Y1, d(baby_bear)/Y, goldilocks/ Z}
Given the following set of clauses use resolution to prove the axiom : expensive(f1car)
1: fast(X)  big(X)
2:  big(Y)  economical(Y)  showy(f1car)
3:  fast(U)  new(U)
4:  showy(T)  high_tax(T)
5:  new(G)
6:  high_tax(S)
7:  economical(Z)  expensive(Z)
1: fast(X)  big(X)
2:  big(Y)  economical(Y)  showy(f1car)
3:  fast(U)  new(U)
4:  showy(T)  high_tax(T)
5:  new(G)
6:  high_tax(S)
7:  economical(Z)  expensive(Z)
To Prove EXPENSIVE(f1car)
ADD 8:NOT EXPENSIVE(f1car)
Resolve 1 and 2 with {X/Y} to get
9: FAST(X) OR ECONOMICAL(X) OR SHOWY(f1car)
Resolve 9 and 3 with {X/U} to get
10: NEW(X) OR ECONOMICAL(X) OR SHOWY(f1car)
Resolve 10 and 5 with {X/G} to get
11:ECONOMICAL(X) OR SHOWY(f1car)
Resolve 11 and 7 with {X/Z} to get
12:EXPENSIVE(X) OR SHOWY(f1car)
Resolve 12 and 8 with {f1car/X} to get
13: SHOWY(f1car)
Resolve 13 and 4 with {f1car/T} to get
14: HIGH_TAX(f1car)
Resolve 14 and 6 with {f1car/S} to get
15: [] QED.
Download