45
Dr. Asaad Sabah Hadi Lecture 4 Resolution

Lecture 4 Resolution

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 4 Resolution

Dr. Asaad Sabah Hadi

Lecture 4

Resolution

Page 2: Lecture 4 Resolution

Resolution theorem proving is a method of formal derivation

(deduction) that has the following features:

• The only formulas allowed in resolution theorem proving

are disjunctions of literals.

• A disjunction of literals is called a clause. Hence, all

formulas involved in resolution theorem proving must be

clauses.

• Resolution follows the refutation principle; that is, it

shows that the negation of the conclusion is inconsistent

with the premises.

• There is essentially only one rule of formal deduction,

resolution.

Page 3: Lecture 4 Resolution

• In general, one can convert any formula into one

or more clauses.

• To do this, one first converts the formula into a

conjunction of disjunctions; that is, one converts the

formula into conjunctive normal form.

• Each term of the conjunction is then made into a

clause of its own. A

Page 4: Lecture 4 Resolution
Page 5: Lecture 4 Resolution

• Two clauses can be resolved if and only if they contain

two complementary literals.

• In this case, they give rise to a new clause, called the

resolvent.

• If the complementary literals are P and ~P, one says the

resolution in on P (or over P).

• The clauses giving rise to the resolvent are called parent

clauses.

• The resolvent on P is the disjunction of all literals of the

parent clauses, except that P and ~P are omitted from

the resolvent. A

Page 6: Lecture 4 Resolution

Example

Page 7: Lecture 4 Resolution

The resolvent is logically implied by its parent clauses, which makes

resolution a sound rule of formal deduction.

To see this, let P be a propositional variable, and let A and B be

(possibly empty) clauses.

One has

P v A, ~P v B = A v B

This is valid for the following reasons:-

• if P is false, then A must be true, because otherwise P v A is false.

• Similarly, if P is true, then B must be true, because otherwise ~P v B is

false.

• Since P must be true or false, either A or B must be true, and the result

follows.

• Of course, A v B is the resolvent of the parent clauses P v A and ~P v B

on P, which proves the soundness of resolution.

Soundness of resolution

Page 8: Lecture 4 Resolution

Unit clauses

Resolution is particularly efective when one of the parent clause is a

unit clause, that is, a clause that contains only one literal.

Example: The resolution of ~P v Q v R and ~R. The resolvent is

~P v Q

Example: The resolution of P v Q with ~P yields Q, which agrees

with the disjunctive syllogism.

Example: The two clauses ~P and P have the empty clause as a

resolvent, which is correct, since P and :P are contradictory

and therefore false like the empty clause.

Page 9: Lecture 4 Resolution

Prove Modus Ponens by resolution

P, P Q = Q

1. P Premise

2. ~P v Q Premise

3. ~Q Negation of conclusion

4. Q Resolvent of 1, 2

5. 0 Resolvent of 3, 4

Page 10: Lecture 4 Resolution

Prove Hypothetical Syllogism by resolution

P Q , Q R = P R

1. ~P v Q Premise

2. ~Q v R Premise

3. P Derived from negation of conclusion

4. ~R Derived from the negation of conclusion

5. Q Resolvent of 1, 3

6. ~Q Resolvent of 2, 4

7. 0 Resolvent of 5, 6

Page 11: Lecture 4 Resolution

Resolution strategies

When doing resolution automatically, one has to

decide in which order to resolve the clauses. This

order can greatly affect the time needed to find a

contradiction. Strategies include:

• Unit resolution: all resolutions involve at least one

unit clause. Moreover, preference is given to

clauses that have not been used yet.

• Set of support strategy

• Davis Putnam procedure

Page 12: Lecture 4 Resolution

Example of unit resolution

Prove P4 from P1 P2, ~P2 , ~P1 P3 v P4, P3 P5, P6

~P5 and P6.

1. ~P1 v P2 Premise

2. ~P2 Premise

3. P1 v P3 v P4 Premise

4. ~P3 v P5 Premise

5. ~P6 v ~P5 Premise

6. P6 Premise

7. ~P4 Negation of conclusion

8. ~P1 Resolvent of 1, 2

9. ~P5 Resolvent of 5, 6

10. P1 v P3 Resolvent of 3, 7

11. ~P3 Resolvent of 4, 9

12. P3 Resolvent of 8, 10

13. 0 Resolvent of 11, 12

Page 13: Lecture 4 Resolution

Unit resolution is not complete

• The unit resolution is not complete.

• This is demonstrated by the following example.

• The premises are Q v R, Q v ~R, and ~Q v R, and

the conclusion is Q ^ R.

• In this case there is no unit clause, which makes

unit resolution impossible.

Page 14: Lecture 4 Resolution

Set of support strategy

• One partitions all clauses into two sets, the set of support and the

auxiliary set.

• The auxiliary set is formed in such a way that the formulas in it

are not contradictory.

• For instance, the premises are usually not inconsistent (not

contradictory). The inconsistency only arises after one adds the

negation of the conclusion.

• One often uses the premises as the initial auxiliary set and the

negation of the conclusion as the initial set of support.

• Since one cannot derive any contradiction by resolving clauses

within the auxiliary set, one avoids such resolutions.

• Stated positively, each resolution takes at least one clause from

the set of support.

• The resolvent is then added to the set of support.

• Resolution with the set of support strategy is complete.

Page 15: Lecture 4 Resolution

Prove P4 from P1 P2 , ~P2, ~P1 P3 v P4, P3 P5, P6 ~P5

and P6, by using the set of support strategy.

Initially the set of support is given by ~P4, the negation of the

conclusion.

One then does all the possible resolutions involving ~P4, then all

possible resolutions involving the resulting resolvents, and so on.

If the initial 7 clauses are omitted, this yields the following derivation:

8. P1 v P3 Resolvent of 7, 3

9. P2 v P3 Resolvent of 1, 8

10. P3 Resolvent of 2, 9

11. P5 Resolvent of 4, 10

12. ~P6 Resolvent of 5, 11

13. 0 Resolvent of 6, 12

Example

Page 16: Lecture 4 Resolution

RESOLUTION • The resolution principle describes a way of finding

contradictions in a knowledge base of clauses with minimum use of substitutions.

• Resolution refutation proves a theorem (a goal) by negating the statement to be proved and adding this negated goal to the set of axioms that are known to be true.

• The resolution rule of inference is used to show that it leads to a contradiction.

• As it is shown that the negated goal is inconsistent with the given set of axioms, it follows that the original goal must be consistent.

Page 17: Lecture 4 Resolution

Resolution refutation algorithm 1. Put the premises or axioms into clause form(conjunction of clauses). 2. Add the negation of the goal as another clause (what is to be

proved) in clause form to the set of axioms. In other words, assume that the negation of the goal is true.

3. Resolve these clauses together, producing new clauses that logically follow from them.

4. Produce a contradiction by generating the empty clause. 5. The substitutions used to produce the empty clause are those under

which the opposite of the negated goal is true. 6. Conclude that the negated goal is false because it causes

contradiction. 7. Conclude that the goal is true.

Page 18: Lecture 4 Resolution

If we have :

C1^ C2 ^ ….. ^ Ck G

We want to prove if this sentence is true or not ?

1- convert it into another forms by using ab = ~a v b :

~ (C1^ C2 ^ ….. ^ Ck ) v G , this is valid

then the negation of it is unsatisfiable:

C1^ C2 ^ ….. ^ Ck ^ ~ G …… (1)

Then if we can prove that the sentence in (1) give false (the set

of rules is inconsistence) then its negation is true and therefore

the original clauses is true.

Page 19: Lecture 4 Resolution

• The rule of inference is sound if all conclusions the rule infers logically follows.

• The rule of inference is complete if it infers all conclusions that logically follows.

• Resolution is a sound inference rule. • Resolution is not complete but it is refutation complete,

i.e., the empty clauses can always be generated whenever a contradiction in the set of clauses exists.

• The most common form of resolution is binary resolution applied to two clauses.

• Resolution is more general than Modus Ponens.

Page 20: Lecture 4 Resolution

The resolution proof procedure requires all

statements in the knowledge base to be converted to a standard form called clause form.

Clause form represents the logical knowledge base as a set of disjunctions of literals.

A literal is an atomic expression or the negation of an atomic expression.

Page 21: Lecture 4 Resolution

Satisfiability, Tautology, Contradiction

A proposition is

• satisfiable, if its truth table contains at least one true .

Example:p ^ q.

• tautology, if it is always true. Example: p v ~p.

• contradiction, if it always false. Example: p ^ ~p.

• contingency, if it is neither a tautology nor a contradiction.

Example: p.

Page 22: Lecture 4 Resolution

The form the knowledge base takes is referred to as a conjunction

of disjuncts. Definition: A conjunction is a compound statement formed by

joining two statements with the connector AND. The conjunction "p and q" is symbolized by pq. A conjunction is true when both of its combined parts are true; otherwise it is false.

• It is a conjunction because all the clauses in the

knowledge base are assumed to be true at the same time. • It is a disjunction in that each of the individual clauses is

expressed with disjunction as the connective.

Page 23: Lecture 4 Resolution

• Algorithm for reducing any set of predicate calculus statements to

clause form must be used. Algorithm consists of a sequence of transformations.

• A set of clauses is inconsistent if and only if (iff)the original set of expressions is inconsistent.

• The clause form may not be strictly equivalent to the original set of predicate calculus expressions in that certain interpretations may be lost. This occurs because skolemization restricts the possible substitutions for existentially quantified variables.

Page 24: Lecture 4 Resolution

Reduction algorithm

1. Eliminate the implication using the equivalence

A B AB 2. Reduce the scope of negation using the

following equivalences (A) A (X)p(X) (X)p(X) (X)p(X) (X)p(X) (AB) AB (AB) AB

Page 25: Lecture 4 Resolution

3. Standardize by renaming all variables so that variables bound by different quantifiers have unique names using the equivalence

( (X)p(X) (X)q(X) ) ( (X)p(X) (Y)q(Y) )

4. Move all quantifiers to the left without changing their order.

After this state the clause is in prefix normal form, because all the quantifiers are in front as in a prefix and the expression or matrix follows after.

Page 26: Lecture 4 Resolution

5. Eliminate all existential quantifiers by skolemization.

6. Drop all universal quantifiers. 7. Convert the expression to the conjunct of

disjuncts form using associative and distributive laws

(a ∧ b) ∨ (c ∧ d) is converted into :

(a ∨ (c ∧ d)) ∧ (b ∨ (c ∧ d)) and finally we get:

(a ∨ c) ∧ (a ∨ d) ∧ (b ∨ c) ∧ (b ∨ d)

Which means multiple clauses connected by AND.

Page 27: Lecture 4 Resolution

8. Call each conjunct a separate clause. 9. Standardize the variables apart by

giving the variable in each clause generated by step 8 different names, and using the equivalence

(X) (p(X)q(X)) (X)p(X) (Y)q(Y)

Page 28: Lecture 4 Resolution

Skolomization • Skolem constant

(∃X)(dog(X)) may be replaced by dog(fido) where the name fido

is picked from the domain of definition of X to represent that

individual X.

• Skolem function

If the predicate has more than one argument and the

existentially quantified variable is within the scope of universally

quantified variables, the existential variable must be a function

of those other variables.

(∀X)(∃Y)(mother(X,Y)) ⇒ (∀X)mother(X,m(X))

(∀X)(∀Y)(∃Z)(∀W)(foo (X,Y,Z,W))

⇒ (∀X)(∀Y)(∀W)(foo(X,Y,f(X,Y),w))

Page 29: Lecture 4 Resolution

Reduction algorithm The importance of this final step becomes apparent

only when unification steps of resolution are presented. The most general unification may be found to make two predicates within two clauses equivalent, and then this substitution is made across all the variables of the same name within each clause. Thus, if some variables share names with others, these may be renamed by the unification process (needlessly) with a subsequent (possible) loss of generality in the solution.

Page 30: Lecture 4 Resolution

Application of reduction algorithm (X)([p(X) t(X)] [q(X,V)

(Y)((Z)[q(Y,Z)] r(X,Y))]) (X)(s(X))

1. Eliminate the

(X)([p(X) t(X)] [q(X,V)

(Y)((Z)[q(Y,Z)] r(X,Y))]) (X)(s(X))

Page 31: Lecture 4 Resolution

2. Reduce the scope of negation

(X)([p(X) t(X)] [q(X,V)

(Y)((Z)[q(Y,Z)] r(X,Y))]) (X)(s(X))

3. Standardize by renaming all variables (X)([p(X) t(X)] [q(X,V)

(Y)((Z)[q(Y,Z)] r(X,Y))]) (W)(s(W))

Page 32: Lecture 4 Resolution

4. Move all quantifiers to the left without changing their order

(X)(Y)(Z)(W)([p(X) t(X)] [q(X,V) (q(Y,Z) r(X,Y))]) s(W)

5. Skolemization (X)(Z)(W)([p(X) t(X)]

[q(X,V) (q(f(X),Z) r(X,f(X)))]) s(W)

Page 33: Lecture 4 Resolution

6. Drop all universal quantifiers [p(X) t(X)] [q(X,V)

(q(f(X),Z) r(X,f(X)))] s(W) 7. Convert the expression to the conjunct

of disjuncts form [p(X) t(X) q(X,V) s(W)]

[p(X) t(X) q(f(X),Z) r(X,f(X)) s(W)]

Page 34: Lecture 4 Resolution

8. Call each conjunct a separate clause (i) p(X) t(X) q(X,V) s(W)

(ii) p(X) t(X) q(f(X),Z)

r(X,f(X)) s(W) 9. Standardize the variables apart (i) p(X) t(X) q(X,V) s(W)

(ii) p(T) t(T) q(f(T),Z)

r(T,f(T)) s(U)

Page 35: Lecture 4 Resolution
Page 36: Lecture 4 Resolution
Page 37: Lecture 4 Resolution
Page 38: Lecture 4 Resolution
Page 39: Lecture 4 Resolution
Page 40: Lecture 4 Resolution
Page 41: Lecture 4 Resolution
Page 42: Lecture 4 Resolution
Page 43: Lecture 4 Resolution
Page 44: Lecture 4 Resolution
Page 45: Lecture 4 Resolution

Thanks for Listening