Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

6.

825 Techniques in Artificial Intelligence Propositional Resolution


• Resolution rule:
Resolution Theorem Proving: avb
Propositional Logic ¬b v g

• Propositional resolution avg


• Resolution refutation:
• Propositional theorem proving • Convert all sentences to CNF
• Unification • Negate the desired conclusion (converted to CNF)
• Apply resolution rule until either
– Derive false (a contradiction)
– Can’t apply any more
• Resolution refutation is sound and complete
• If we derive a contradiction, then the conclusion follows from the
axioms
• If we can’t apply any more, then the conclusion cannot be proved
from the axioms.

Lecture 7 • 1 Lecture 7 • 2

Propositional Resolution Example Propositional Resolution Example


Step Formula Derivation Step Formula Derivation
Prove R 1 PvQ Given Prove R 1 PvQ Given
1 PvQ 2 ¬PvR Given 1 PvQ 2 ¬PvR Given
3 ¬QvR Given
2 P→R 2 P→R 3 ¬QvR Given
4 ¬R Negated
3 Q→R conclusion 3 Q→R 4 ¬R Negated
conclusion
5 QvR 1,2
5 QvR 1,2
6 ¬P 2,4
6 ¬P 2,4
7 ¬Q 3,4 false v R
¬ R v false 7 ¬Q 3,4
8 R 5,7
9 • 4,8 false v false 8 R 5,7
9 • 4,8

Lecture 7 • 3 Lecture 7 • 4

Propositional Resolution Example The Power of False


Step Formula Derivation
Prove R 1 PvQ Given Prove Z Step Formula Derivation
1 PvQ 2 ¬PvR Given 1 P 1 P Given
2 ¬P Given
2 P→R 3 ¬QvR Given 2 ¬P
3 ¬Z Negated
3 Q→R 4 ¬R Negated
conclusion
conclusion
4 • 1,2
5 QvR 1,2
6 ¬P 2,4
false v R
Note that (P ¬ P) → Z is valid
¬ R v false 7 ¬Q 3,4
Any conclusion follows from a contradiction – and so
false v false 8 R 5,7 strict logic systems are very brittle.
9 • 4,8

Lecture 7 • 5 Lecture 7 • 6

1
Example Problem Example Problem
Convert to CNF Convert to CNF
Prove R Prove R
• ¬(¬ P v Q) v Q • ¬(¬ P v Q) v Q
(P → Q) → Q • (P ¬ Q) v Q (P → Q) → Q • (P ¬ Q) v Q
1 1
• (P v Q) (¬ Q v Q) • (P v Q) (¬ Q v Q)
2 (P → P) → R 2 (P → P) → R
• (P v Q) • (P v Q)

3 (R → S) → ¬(S → Q) 3 (R → S) → ¬(S → Q)
• ¬(¬ P v P) v R
• (P ¬ P) v R
• (P v R) (¬ P v R)

Lecture 7 • 7 Lecture 7 • 8

Example Problem Resolution Proof Example


1 PvQ
Convert to CNF
Prove R Prove R 2 PvR
• ¬(¬ P v Q) v Q

1 (P → Q) → Q • (P ¬ Q) v Q 1 (P → Q) → Q 3 ¬PvR
• (P v Q) (¬ Q v Q) 4 RvS
2 (P → P) → R 2 (P → P) → R
• (P v Q) 5 Rv¬Q
(R → S)
3 (R → S) → ¬(S → Q)
• ¬(¬ P v P) v R 3 → ¬←(S →
6 ¬Sv¬Q
• (P ¬ P) v R Q)
7 ¬R Neg
• (P v R) (¬ P v R)

• ¬(¬ R v S) v ¬ (¬ S v Q)
• (R ¬ S) v (S ¬ Q)
• (R v S) (¬ S v S) ←(R v ¬ Q) ←←(¬ S v ¬ Q)
• (R v S) (R v ¬ Q) ←←(¬ S v ¬ Q)
Lecture 7 • 9 Lecture 7 • 10

Resolution Proof Example Proof Strategies


1 PvQ
• Unit preference: prefer a resolution step involving
Prove R 2 PvR an unit clause (clause with one literal).
3 ¬PvR
1 (P → Q) → Q • Produces a shorter clause – which is good since we are
4 trying to produce a zero-length clause, that is, a
RvS
2 (P → P) → R contradiction.
5 Rv¬Q
(R → S) • Set of support: Choose a resolution involving the
3 → ¬←(S → 6 ¬Sv¬Q negated goal or any clause derived from the
Q) negated goal.
7 ¬R Neg
• We’re trying to produce a contradiction that follows from
8 S 4,7 the negated goal, so these are “relevant” clauses.
9 ¬Q 6,8 • If a contradiction exists, one can find one using the set-of-
support strategy.
10 P 1,9
11 R 3,10
12 • 7,11
Lecture 7 • 11 Lecture 7 • 12

2
Recitation Problems First-Order Resolution
uppercase letters:
Using resolution refutation, prove the last sentence in ∀ x. P(x) → Q(x) Syllogism: constants
each group from the rest of the sentences in the All men are mortal
lowercase letters:
P(A) Socrates is a man
group. Socrates is mortal
variables
Q(A)
ÿ(P ŸÿQ) ⁄ÿ(ÿS ŸÿT )
P ÆQ (P Æ Q) ⁄ (R Æ S)
ÿ(T ⁄ Q)
ÿP Æ R (P Æ S) ⁄ (R Æ Q) ∀ x. ¬ P(x) v Q(x)
U Æ (ÿT Æ (ÿS Ÿ P)) Equivalent by
ÿQ ÆÿR
P(A) definition of
ÿU The key is finding
implication
Q(A) the correct
substitutions for
Use resolution refutation to do problem 6.5 from R&N. the variables.
Substitute A for
¬ P(A) v Q(A) x, still true
P(A) then
Q(A) Propositional
Lecture 7 • 13 resolution Lecture 7 • 14

Substitutions Unification
P(x, F(y), B) : an atomic sentence • Expressions w1 and w2 are unifiable iff there exists a
Substitution Substitution Comment substitution s such that w1 s = w2 s
instances {v1 /t1,…, vn /tn} • Let w1 = x and w2 = y, the following are unifiers
P(z, F(w), B) {x/z, y/w} Alphabetic
variant
P(x, F(A), B) {y/A} s w1 s w2 s
{y/x} x x
P(G(z), F(A), B) {x/G(z), y/A}

{x/y} y y
P(C, F(A), B) {x/C, y/A} Ground instance †
{x/F(F(A)), y/F(F(A))} F(F(A))
† F(F(A))

Applying a substitution: {x/A, y/A} A A

subst({A/y},P(x, F(y), B)) = P(x, F(A), B)


P(x, F(y), B) {A/y} = P(x,F(A),B)
Lecture 7 • 15 Lecture 7 • 16

Most General Unifier Unification Algorithm


g is a most general unifier of w1 and w2 iff for all unify(Expr x, Expr y, Subst s){
unifiers s, there exists s$ such that w1 s = (w1 g) s$ if s = fail, return fail
and w2 s = (w2 g) s$ else if x = y, return s
else if x is a variable, return unify-var(x, y, s)
else if y is a variable, return unify-var(y, x, s)
w1 w2 MGU
else if x is a predicate or function application,
P(x) P(A) {x/A} if y has the same operator,
P(F(x), y, G(x)) P(F(x), x, G(x)) {y/x} or {x/y} return unify(args(x), args(y), s)
P(F(x), y, G(y)) P(F(x), z, G(x)) {y/x, z/x} else return fail
P(x, B, B) P(A, y, z) {x/A, y/B, z/B} else ; x and y have to be lists
return unify(rest(x), rest(y),
P(G(F(v)), G(u)) P(x, x) {x/G(F(v)), u/F(v)}
unify(first(x), first(y), s))
P(x, F(x)) P(x, x) No MGU!
}

Lecture 7 • 17 Lecture 7 • 18

3
Unify-var subroutine Unification Problems
Substitute in for var and x as long as possible, then add new For each pair of sentences, give an MGU.
binding
Color(Tweety, Yellow) Color(x,y)
unify-var(Variable var, Expr x, Subst s){
if var is bound to val in s, Color(Tweety, Yellow) Color(x,x)
return unify(val, x, s) Color(Hat(John), Blue) Color(Hat(y), x)
else if x is bound to val in s, R(F(x), B) R(y,z)
return unify-var(var, val, s)
R(F(y), x) R(x, F(B))
else if var occurs anywhere in x, return fail
else return add({var/x}, s)
R(F(y), y, x) R(x, F(A), F(v))
} Loves(x, y) Loves(y, x)
F(G(w), H(w, J(x, y))) F(G(v), H(u, v))
Note: last line incorrect in book! F(G(w), H(w, J(x, u))) F(G(v), H(u, v))
F(x, F(u, x)) F(F(y, A), F(z, F(B,z)))

Lecture 7 • 19 Lecture 7 • 20

Inference using Unification


∀ x. ¬ P(x) v Q(x)

P(A)
Q(A)

For universally quantified variables, find MGU {x/A} and


proceed as in propositional resolution.

Lecture 7 • 21

You might also like