the law of resolution formal aspects of computer science - week 7 the law of resolution lee...

10
The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email [email protected] http://scom.hud.ac.uk/scomtlm/ cia2326

Upload: osborne-todd

Post on 21-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

Formal Aspects of Computer Science - Week 7The Law of Resolution

Lee McCluskey, room 2/07

Email [email protected]

http://scom.hud.ac.uk/scomtlm/cia2326

Page 2: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

Recap and Motivation

•We want to be able to reason with logic using tools in order to prove properties about specifications / requirements / code, and enable reasoning in intelligent agents.

•Just study ONE law of inference to do this Resolution.

This law is often embodied is a “proof procedure” called Resolution Refutation which is SOUND and COMPLETE.

Page 3: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

SOME JARGON

To carry out Resolution, we need to learn about: The Clausal form of wffs (a little bit like clauses in

Prolog) The Process of Unification (very similar to Prolog

matching)

Resolution Form:

Parent Clause1 Parent Clause2

Child Clause

Page 4: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

SOME JARGON ABOUT CLAUSES

A LITERAL is a predicate - called a positive literal, or predicate preceded by a “~”, called a negative literal.

3 Example literals: on(x,y), ~on(x,table), green(table). A CLAUSE is a disjunction of literals in which any variable

is assumed to be universally quantified. Sometimes we think of a clause as a SET of literals implicitly “disjuncted”.

Example: on(x,y) v ~on(x,table) v green(table)

Or in set notation {on(x,y), ~on(x,table), green(table)} A set of wffs w1, w2, ... wn is in CLAUSAL FORM if each

wi (i=1 to n) is a clause

Page 5: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

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 [TRICKY STEP]

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.

Page 6: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

Student Example from last week…

S = student, D = academic, T = teachesAx ( S(x)=>D(x) ) ; Ax ( (Ey (T(x,y) & D(y) ) => D(x) )S(Fred) ; T(Jeff,Fred)

CLAUSAL FORM:

1. ~S(x) V D(x) 2. ~T(x,y) V ~D(y) V D(x) 3. S(Fred) 4. T(Jeff,Fred)

Page 7: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

Unification: the process of substitution

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 a clause we may write:

W[T/x]

meaning perform the textual substitution T for x throughout W.

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]}.

Page 8: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

Unification - definition

A set of literals unify if and only if a step by step application of a sequence (possibly null) 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

Page 9: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

The Law of (Binary) ResolutionTwo 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.

Page 10: The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07 Email lee@hud.ac.uklee@hud.ac.uk

The Law of Resolution

Summary

Resolution is a law of inference that is based on:

- Wffs in CLAUSAL FORM

- The process of UNIFICATION of literals

It inputs TWO clauses and outputs a child clause.