Document 7362393

Download Report

Transcript Document 7362393

AI - Week 16
Logic and Reasoning in AI:
Resolution Refutation
Lee McCluskey, room 2/07
Email [email protected]
http://scom.hud.ac.uk/scomtlm/cha2555/
Recap
•First order logic is an expressive way of representing
knowledge in general.
•Expressions in FOL are called “wffs”. Laws of
Inference are methods for deducing wffs from
wffs.They are SOUND if they only ever deduce wffs
that also logically follow.
•We want to embed sound laws of inference in
software that will be able to perform automated
reasoning efficiently.
Logic and Reasoning in AI
Aside: Proof by Contradiction
(Sometimes called Proof by Refutation or
Reductio ad Absurdum)
This is an efficient way of reasoning:
assume what we are trying to prove is FALSE, then get a
CONTRADICTION
=> what we were trying to prove is TRUE.
Imagine we know Wff1 to be TRUE and we want to prove
Wff2 logically follows from Wff1. If we can derive a
contradiction from
(Wff1 & ~Wff2)
then assuming Wff1 is TRUE we know that Wff2 logically
follows from Wff1, or written in logic:
Wff1 |- Wff2
Logic and Reasoning in AI
Resolution Refutation
Resolution is a super law of inference which
- can easily be automated
- when used in refutation mode it is COMPLETE - it can deduce
any Wff that logically follows.
- is the basis for Prolog
Resolution Refutation: To PROVE Wff2 FROM Wff1
1. Translate Wff1 to CLAUSAL FORM
2. Translate ~ Wff2 to CLAUSAL FORM
3. Get contradiction from 1 + 2 using Resolution
…. If follows that Wff1 |- Wff2
Logic and Reasoning in AI
SOME JARGON

To do resolution refutation, we need to learn about:





Clausal form (covered it a bit last week)
Unification (just Prolog matching ..)
A LITERAL is a predicate which may be negated, called a
negative literal, or a predicate itself, called a positive literal.
A CLAUSE is a disjunction of literals which contain only
universally quantified variables. Sometimes we think of a
clause as a SET of literals implicitly “disjuncted”.
A set of wffs w1, w2, ... wn is in CLAUSAL FORM if each
wi (i=1 to n) is a clause
Logic and Reasoning in AI
To change any Wff to Clausal Form:
Those Eight Steps ……..
1. Replace any occurrences of <=> using the law:
A <=> B = (A => B) & (A <= B)
2. Replace all occurrences of => and <= using the laws:
A => B = ~A v B …and... A <= B = A v ~B
3. Reduce the scope of every “~” so that they all operate on predicates. To do this
use you may need the laws:
~(Ax wff) = Ex (~wff) and ~(Ex wff) = Ax (~wff) etc
4. Standardise variables - make sure all quantified variables are different
5. Eliminate existential quantifiers - change into Skolem Constants
6. Universal quantifiers can now all be removed, making every variable implicitly
universally quantified.
7. Use the laws to convert to conjunctions of disjunctive literals
(A & B) V C = (AVC) & (B V C)
8. Making all the conjunctions implicit, we are left with a set of clauses.
Logic and Reasoning in AI
Unification - substition
The law of resolution depends on the idea of “unification”. This
virtually the same as matching in Prolog. We first introduce
the idea of substitution:
A legal substitution is the consistent replacing of a variable
symbol x by a term T on condition that T does not contain any
occurrence of x. If W is either is a clause we may write:
W[T/x]
meaning perform the textual substitution T for x throughout W,
or if we have a sequence of substitutions S, we write
W/S
meaning perform the following sequence of substitutions on W:
S = { [T1/x1], ..., [Tn/xn]}.
Logic and Reasoning in AI
Unification - definition
A set of literals unify if and only if each literal in the set is
identical or a step by step application of a sequence of legal
substitutions make them identical. Identical here means:
- they all have the same predicate symbol;
- they all have the same polarity;
- they all have the same number of slots;
- they all have identical terms in corresponding slots.
Given a set of literals we can try to UNIFY them by applying
substitutions systematically
Logic and Reasoning in AI
The Law of (Binary) Resolution
Two PARENT clauses w1 and w2 infer a CHILD clause wr if
there are literals L in w1 and M in w2 such that {L,~M}
unify under some substitution sequence S.
Remembering that clauses are sets of literals, we can deduce
wr = [ w1 U w2 minus { L, ~ M } ]/S.
The law also assumes that each clause has unique variable
letters. This does not restrict its generality because variables
in separate clauses are independent.
Logic and Reasoning in AI
Example
S = student, D = academic, T = teaches
Ax ( S(x)=>D(x) ) ;
Ax ( (Ey (T(x,y) & D(y) ) => D(x) )
S(Fred) ; T(Jeff,Fred)
Goal: D(Jeff)
CLAUSAL FORM of Wff1 & ~Wff2:
1. ~S(x) V D(x)
2. ~T(x,y) V ~D(y) V D(x)
3. S(Fred)
4. T(Jeff,Fred)
5. ~D(Jeff)
Logic and Reasoning in AI
Example
1. ~S(x) V D(x)
3. S(Fred)
Subs = Fred / x
D(Fred)
2. ~T(x,y) V ~D(y) V D(x)
Subs = Fred / y
5. ~D(Jeff)
~T(x,Fred) V D(x)
Subs = Jeff / x
~T(Jeff,Fred)
4. T(Jeff,Fred)
..So D(Jeff) follows from our premises
Logic and Reasoning in AI
Summary
Resolution is a law of inference that is based on:
- Wffs in CLAUSAL FORM
- The method of UNIFICATION of literals
Resolution Refutation is a deduction procedure that is
 COMPLETE
 amenable to AUTOMATION
 PROLOG works using “single literal depth-first” (SLD)
resolution
Logic and Reasoning in AI