ai assignment

37
2 Assignment 5. Due Date: 09/04/10 1. Consider axioms from Assignment 4 . Prove that John likes peanuts using resolution . 2. Consider the following facts: The members of the Elm St. Bridge Club are Joe, Sally, Bill, and Ellen. Joe is married to Sally. Bill is Ellen’s brother. The spouse of every married person in the club is also in the club. The last meeting of the club was at Joe’s house. (a) Represent these facts in the predicate logic. (b) From the facts given above, most people would be able to decide on the truth of the following additional statements: The last meeting of the club was at Sally’s house. Ellen is not married. Can you construct resolution proofs to demonstrate the truth of each of these statements given the five listed above? Do so if possible. Otherwise, add the facts you need and then construct the proofs. 3. Assume the following facts: Steve only likes easy courses. Science courses are hard. All the courses in the basketweaving department are easy. BK 301 is a basketweaving course. Use resolution to answer the question, “What course would Steve like?” (read pp. 160-164 of the handout)

Upload: frens0

Post on 24-Nov-2014

800 views

Category:

Documents


32 download

TRANSCRIPT

Page 1: Ai Assignment

2

Assignment 5. Due Date: 09/04/10

1. Consider axioms from Assignment 4. Prove that John likes peanuts using resolution. 2. Consider the following facts:

• The members of the Elm St. Bridge Club are Joe, Sally, Bill, and Ellen.

• Joe is married to Sally. • Bill is Ellen’s brother. • The spouse of every married person in the club is also

in the club. • The last meeting of the club was at Joe’s house.

(a) Represent these facts in the predicate logic. (b) From the facts given above, most people would be able

to decide on the truth of the following additional statements: • The last meeting of the club was at Sally’s house. • Ellen is not married.

Can you construct resolution proofs to demonstrate the truth of each of these statements given the five listed above? Do so if possible. Otherwise, add the facts you need and then construct the proofs.

3. Assume the following facts: • Steve only likes easy courses. • Science courses are hard. • All the courses in the basketweaving department are

easy. • BK 301 is a basketweaving course.

Use resolution to answer the question, “What course would Steve like?” (read pp. 160-164 of the handout)

Page 2: Ai Assignment

3

Conversion to Clause Form:All Romans who know Marcus either hate Caesar or think that anyone who hates anyone is crazy. Problem: ∀x: [Roman(x) ∧ know(x, Marcus)] → [hate(x, Caesar) ∨ (∀y: ∃z: hate(y, z) → thinkcrazy(x, y))] Solution:

• Flatten • Separate out quantifiers

Conjunctive Normal Form: ¬Roman(x) ∨ ¬know(x, Marcus) ∨ hate(x, Caesar) ∨ ¬hate(y, z) ∨ thinkcrazy(x,z) Clause Form:

• Conjunctive normal form • No instances of ∧

Page 3: Ai Assignment

4

Algorithm: Convert to Clause Form

1. Eliminate →, using: a → b = ¬a ∨ b. 2. Reduce the scope of each ¬ to a single term, using:

• ¬(¬p) = p • de Morgan’s laws: ¬(a ∧ b) = ¬a ∨ ¬b

¬(a ∨ b) = ¬a ∧ ¬b • ¬∀x: P(x) = ∃x: ¬P(x) • ¬∃x: P(x) = ∀x: ¬P(x)

3. Standardize variables: ∀x: P(x) ∨ ∀x: Q(x) should be replaced with ∀x: P(x) ∨ ∀y: Q(y) (y is a unique variable)

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

5. Eliminate existential quantifiers by inserting Skolem functions.

6. Drop the prefix. 7. Convert the matrix into a conjunction of disjuncts, using

associativity and distributivity. 8. Create a separate clause for each conjunct. Standardize

apart the variables in the set of clauses generated in step 8, using the fact that

(∀x: P(x) ∧ Q(x)) = ∀x: P(x) ∧ ∀x: Q(x), thus we have two clauses P(x) Q(y)

Page 4: Ai Assignment

5

Examples of Conversion to Clause Form Example: ∀x: [Roman(x) ∧ know(x, Marcus)] → [hate(x, Caesar) ∨ (∀y: ∃z: hate(y, z) → thinkcrazy(x, y))] 1. Eliminate → ∀x: ¬[Roman(x) ∧ know(x, Marcus)] ∨ [hate(x, Caesar) ∨ (∀y: ¬(∃z: hate(y,z)) ∨ thinkcrazy(x, y))] 2. Reduce scope of ¬

∀x: [¬Roman(x) ∨ ¬know(x, Marcus)] ∨ [hate(x, Caesar) ∨ (∀y: ∀z: ¬hate(y,z) ∨ thinkcrazy(x, y))]

3. Standardize variables. ∀x: P(x) ∨ ∀x: Q(x) will be converted to ∀x: P(x) ∨ ∀y: Q(y) 4. Move quantifiers prefix matrix ∀x: ∀y: ∀z: [¬Roman ∨ ¬know(x, Marcus)] ∨

[hate(x, Caesar) ∨ (¬hate(y, z) ∨ thinkcrazy(x, y))]

Page 5: Ai Assignment

6

Examples of Conversion to Clause Form 5. Eliminate existential quantifiers. ∃y: President(y) will be converted to President(S1) while ∀x: ∃y: father-of(y, x) will be converted to ∀x: father-of(S2(x), x)) 6. Drop the prefix

[¬Roman(x) ∨ ¬know(x, Marcus)] ∨ [hate(x, Caesar) ∨ (¬hate(y, z) ∨ thinkcrazy(x, y))]

7. Convert to a conjunction of disjuncts. ¬Roman(x) ∨ ¬know(x, Marcus) ∨ hate(x, Caesar) ∨ ¬hate(y, z) ∨ thinkcrazy(x, y)

Page 6: Ai Assignment

7

Examples of Conversion to Clause Form Distribution Law (a ∧ b) ∨ c = (a ∨ c) ∧ (b ∨ c) The formula

(winter ∧ wearingboots) ∨ (summer ∧ wearingsandals) becomes [winter ∨ (summer ∧ wearingsandals)] ∧ [wearingboots ∨ (summer ∧ wearingsandals)] and then becomes (winter ∨ summer) ∧ (winter ∨ wearingsandals) ∧

(wearingboots ∨ summer) ∧ (wearingboots ∨ wearingsandals)

and finally (winter ∨ summer) (winter ∨ wearingsandals)

(wearingboots ∨ summer) (wearingboots ∨ wearingsandals)

Page 7: Ai Assignment

8

A Set of Facts about Marcus

1. man(Marcus) 2. Pompeian(Marcus) 3. born(Marcus, 40) 4. ∀x: man(x) → mortal(x) 5. ∀x: Pompeian(x) → died(x, 79) 6. erupted(volcano, 79) 7. ∀x: ∀t1: ∀ t2: mortal(x) ∧ born(x, t1) ∧

gt(t2 - t1, 150) → dead(x, t2) 8. now = 2009 9. ∀x: ∀t: [alive(x, t) → ¬dead(x, t)] ∧ [¬dead(x, t) → alive(x, t)] 10. ∀x: ∀ t1: ∀ t2: died(x, t1) ∧ gt(t2, t1) → dead(x, t2)

Page 8: Ai Assignment

9

Axioms in clause form:

1. man(Marcus) 2. Pompeian(Marcus) 3. born(Marcus, 40) 4. ¬ man(x1) ∨ mortal(x1) 5. ¬Pompeian(x2)∨ died(x2, 79) 6. erupted(volcano, 79) 7. ¬mortal(x3) ∨ ¬born(x3, t1) ∨

¬gt(t2 - t1, 150) ∨ dead(x3, t2) 8. now = 2009 9. ¬alive(x4, t3) ∨ ¬dead(x4, t3) 10. dead(x 5, t4) ∨ alive(x5, t4) 11. ¬died(x6, t5) ∨ ¬gt(t6, t5) ∨ dead(x6, t6)

Page 9: Ai Assignment

10

The Basis of Resolution Given: winter ∨ summer

¬winter ∨ cold

We can conclude:

summer ∨ cold

Two clauses winter and ¬winter produce the empty clause.

Page 10: Ai Assignment

11

Algorithm: Propositional Resolution

1. Convert all the propositions of F to clause form. 2. Negate P and convert the result to clause form. Add it to

the set of clauses obtained in step 1. 3. Repeat until either a contradiction is found or no progress

can be made: (a) Select two clauses. Call these the parent clauses. (b) Resolve them together. The resolvent will be the

disjunction of all the literals of both of the parent clauses with the following exception: If there are any pairs of literals L and ¬L such that one of the parent clauses contains L and the other contains ¬L. then select one such pair and eliminate both L and ¬L from the resolvent.

(c) If the resolvent is the empty clause, then a contradiction has been found. If it is not, then add it to the set of clauses available to the procedure.

Page 11: Ai Assignment

12

Propositional Resolution

We want to prove R. Given Axioms Clause Form P P (1) (P ∧ Q) → R ¬P ∨ ¬Q ∨ R (2) (S ∨ T) → Q ¬S ∨ Q (3)

¬T ∨ Q (4) T T (5) ¬P ∨ ¬Q ∨ R ¬R

¬P∨ ¬Q P

¬T ∨ Q ¬ Q

¬T T

Page 12: Ai Assignment

13

Herbrand’s Theorem

• To show that a set of clauses S is unsatisfiable, it is

necessary to consider only interpretations over a particular set, called the Herbrand universe of S.

• A set of clauses S is unsatisfiable if and only if a finite

subset of ground instances (in which all bound variables have had a value substituted for them) of S is unsatisfiable.

Page 13: Ai Assignment
Page 14: Ai Assignment
Page 15: Ai Assignment
Page 16: Ai Assignment
Page 17: Ai Assignment
Page 18: Ai Assignment
Page 19: Ai Assignment
Page 20: Ai Assignment
Page 21: Ai Assignment
Page 22: Ai Assignment
Page 23: Ai Assignment
Page 24: Ai Assignment
Page 25: Ai Assignment
Page 26: Ai Assignment
Page 27: Ai Assignment
Page 28: Ai Assignment
Page 29: Ai Assignment
Page 30: Ai Assignment
Page 31: Ai Assignment
Page 32: Ai Assignment
Page 33: Ai Assignment
Page 34: Ai Assignment
Page 35: Ai Assignment
Page 36: Ai Assignment
Page 37: Ai Assignment