Professional Documents
Culture Documents
Solutions
Sandeep Mathias
October 2023
Instructions
1. The following examples of first order resolution are there for practice.
Please try and solve them!
2. Please note that these are important for the mid-term examination.
3. These are sample solutions for SEVEN of the problems. Please try to do
the rest on your own.
Answers
1
Question #1
Consider the following statements:
4. Everyone’s parents who are also alive, are older than them.
Answer #1
Conversion to CNF:
1. ENG: Lulu is the mother of Fifi
FOL: mother(Lulu, Fifi)
CNF: mother(Lulu, Fifi)
2
Listing the clauses:
The following are the clauses:
1. mother(Lulu, Fifi)
2. alive(Lulu)
3. ¬mother(x3, y3) ∨ parent(x3, y3)
4. ¬parent(x4, y4) ∨ ¬ alive(x4) ∨ older(x4, y4)
5. ¬older(Lulu, Fifi)
3
Question # 2
Consider the following statements:
• intelligent(x) = x is intelligent.
• commonSense(x) = x has common sense.
Answer # 2
Conversion to CNF:
1. ENG: If something is intelligent, it has common sense.
FOL: ∀x intelligent(x) → commonSense(x)
CNF: ¬intelligent(x1) ∨ commonSense(x1)
2. ENG: Deep Blue does not have common sense.
FOL: ¬commonSense(Deep Blue)
CNF: ¬commonSense(Deep Blue)
4
Question #3
Consider the following statements:
Answer #3
Conversion to CNF:
1. ENG: Anyone who has allergies will sneeze.
FOL: ∀x allergies(x) → sneeze(x)
CNF: ¬allergies(x1) ∨ sneeze(x1)
2. ENG: If anyone has a cat, but is also allergic to cats, then they have
allergies.
FOL: ∀x ∃y (cat(x,y) ∧ allergicToCats(x)) → allergies(x)
CNF: ¬cat(x2, Felix) ∨ ¬allergicToCats(x2) ∨ allergies(x2)
3. ENG: Mary is allergic to cats.
FOL: allergicToCats(Mary)
CNF: allergicToCats(Mary)
4. ENG: Mary has a cat named Felix
FOL: cat(Mary, Felix)
CNF: cat(Mary, Felix)
5
Listing the clauses:
The following are the clauses:
1. ¬allergies(x1) ∨ sneeze(x1)
2. ¬cat(x2, Felix) ∨ ¬allergicToCats(x2) ∨ allergies(x2)
3. allergicToCats(Mary)
4. cat(Mary, Felix)
5. ¬sneeze(Mary)
6
Question #4
Consider the following axioms:
1. All hounds howl at night.
2. Anyone who has any cats, will not have any mice.
3. Light sleepers do not have anything which howls at night.
4. John has either a cat or a hound
Prove that: If John is a light sleeper, then John does not have any mice.
Use the following predicates:
• hound(x) = x is a hound
• howl(x) = x howls at night
• cat(x) = x is a cat
• has(x, y) = x has y
• mouse(x) = x is a mouse
• LS(x) = x is a light sleeper.
Answer #4
Conversion to CNF
1. ENG: All hounds howl at night.
FOL: ∀x hound(x) → howl(x)
CNF: ¬hound(x1) ∨ howl(x1)
2. ENG: Anyone who has any cats, will not have any mice.
FOL: ∀x ∀y (cat(y) ∧ has(x, y)) → (∀z mouse(z) → ¬has(x,z))
CNF: ¬cat(y2) ∨ ¬has(x2, y2) ∨ ¬mouse(z2) ∨ ¬has(x2,z2)
3. ENG: Light sleepers do not have anything which howls at night.
FOL: ∀x LS(x) → (∀y howl(y) → ¬has(x, y))
CNF: ¬LS(x3) ∨ ¬howl(y3) ∨ ¬has(x3, y3)
4. ENG: John has either a cat or a hound.
FOL: ∃x (hound(x) ∨ cat(x)) ∧ has(John, x)
CNF: (hound(P) ∨ cat(P)) ∧ has(John, P)
7
List of Clauses
1. ¬hound(x1) ∨ howl(x1)
2. ¬cat(y2) ∨ ¬has(x2, y2) ∨ ¬mouse(z2) ∨ ¬has(x2,z2)
3. ¬LS(x3) ∨ ¬howl(y3) ∨ ¬has(x3, y3)
4A. hound(P) ∨ cat(P)
4B. has(John, P)
5A. LS(John)
5B. mouse(x5)
5C. has(John, x5)
8
Question #5
Consider the following axioms:
• person(x) = x is a person
• ruler(x) = x is a ruler
• loyalTo(x,y) = x is loyal to y.
• hate(x,y) = x hates y.
• assassinate(x, y) = x assassinates y.
Answer #5
Conversion to CNF:
1. ENG: Marcus was a man.
FOL: man(Marcus)
CNF: man(Marcus)
2. Marcus was a Roman.
FOL: Roman(Marcus)
CNF: Roman(Marcus)
3. All men are people.
FOL: ∀x man(x) → person(x)
CNF: ¬man(x3) ∨ person(x3)
9
4. Caesar was a ruler.
FOL: ruler(Caesar)
CNF: ruler(Caesar)
5. All Romans were either loyal to Caesar or hated him.
FOL: ∀xRoman(x) → loyalTo(x, Caesar) ∨ hate(x, Caesar)
CNF: ¬Roman(x5) ∨ loyalTo(x5, Caesar) ∨ hate(x5, Caesar)
6. Everyone is loyal to someone.
FOL: ∀x ∃y loyalTo(x, y)
CNF: loyalTo(x6, P)
7. People only assassinate rulers that they are not loyal to.
FOL: ∀x ∀y (person(x) ∧ ruler(y) ∧ assassinate(x, y)) → ¬loyalTo(x, y)
CNF: ¬person(x7) ∨ ¬ruler(y7) ∨ ¬assassinate(x7, y7) ∨ ¬loyalTo(x7,
y7)
8. Marcus assassinated Caesar.
FOL: assassinate(Marcus, Caesar)
CNF: assassinate(Marcus, Caesar)
List of Clauses:
1. man(Marcus)
2. Roman(Marcus)
3. ¬man(x3) ∨ person(x3)
4. ruler(Caesar)
5. ¬Roman(x5) ∨ loyalTo(x5, Caesar) ∨ hate(x5, Caesar)
6. loyalTo(x6, P)
7. ¬person(x7) ∨ ¬ruler(y7) ∨ ¬assassinate(x7, y7) ∨ ¬loyalTo(x7, y7)
8. assassinate(Marcus, Caesar)
9. ¬hate(Marcus, Caesar)
10
Resolution:
Combine 9 & 5, x5 = Marcus, we get:
10. ¬Roman(Marcus) ∨ loyalTo(Marcus, Caesar)
Combine 7 & 8, x7 = Marcus, y7 = Caesar, we get:
11. ¬person(Marcus) ∨ ¬ruler(Caesar) ∨ ¬loyalTo(Marcus, Caesar)
Combine 1 & 3, x3 = Marcus, we get:
12. person(Marcus)
Combine 10 & 2, we get:
13. loyalTo(Marcus, Caesar)
Combine 11 & 13, we get:
14. ¬person(Marcus) ∨ ¬ruler(Caesar)
Combine 14 & 4, we get:
15. ¬person(Marcus)
Combine 15 & 12, we get:
16. ϕ
11
Question #6
Consider the following axioms:
Prove that: If Jim is not a lawyer, then Mary does not like Jim.
Use the following predicates:
• rides(x, y) = x rides y
• MB(x) = x is a motorbike
• thug(x) = x is a thug
• biker(x) = x is a biker
• BMW(x) = x is a BMW
• lawyer(x) = x is a lawyer
• niceGirl(x) = x is a nice girl
• likes(x, y) = x likes y
12
Question #7
Consider the following axioms:
1. Anyone who passes his exam and wins the lottery is happy.
2. Anyone who studies or is lucky can pass his exam.
3. John did not study but is lucky.
• happy(x) = x is happy
• lucky(x) = x is lucky.
Answer #7
Conversion to CNF:
1. ENG: Anyone who passes his exam and wins the lottery is happy.
FOL: ∀x (passes(x) ∧ wins(x) ) → happy(x)
CNF: ¬passes(x1) ∨ ¬wins(x1) ∨ happy(x1)
2. Anyone who studies or is lucky can pass his exam.
FOL: ∀x (studies(x) ∨ lucky(x)) → pass(x)
CNF: (¬studies(x2) ∨ pass(x2)) ∧ (¬lucky(x2)) ∨ pass(x2))
3. John did not study but is lucky.
FOL: ¬study(John) ∧ lucky(John)
CNF: ¬study(John) ∧ lucky(John)
4. Anyone who is lucky wins the lottery.
FOL: ∀x lucky(x) → wins(x)
CNF: ¬lucky(x4) ∨ wins(x4)
13
List of Clauses:
1. ¬passes(x1) ∨ ¬wins(x1) ∨ happy(x1)
2A. ¬studies(x2) ∨ passses(x2)
2B. ¬lucky(x2) ∨ passses(x2)
3A. ¬study(John)
3B. lucky(John)
4. ¬lucky(x4) ∨ wins(x4)
5. ¬happy(John)
14
Question #8
Consider the following axioms:
• happy(x) = x is happy.
• exciting(x) = x has an exciting life.
15
Question #9
Consider the following axioms:
16
Question #10
Consider the following axioms:
NOTE: Here all the variables refer to animals, so there is no need for a
predicate animal(x) = x is an animal.
17
Question #11
Consider the following axioms:
1. Anyone who buys carrots by the bushel owns either a rabbit or a grocery
store.
2. Every dog chases some rabbit.
Prove that: If Mary does not own a grocery store, then she will not data
John.
Use the following predicates:
• buy(x) = x buys carrots by the bushel.
• owns(x, y) = x owns y
• rabbit(x) = x is a rabbit
• grocery(x) = x is a grocery store.
• dog(x) = x is a dog
• chase(x, y) = x chases y.
• own(x, y) = x owns y.
• hate(x, y) = x hates y.
• date(x, y) = x dates y
18
Question #12
Consider the following axioms:
Prove that: If John does not study, then Mary does not love John.
Use the following predicates:
• loves(x, y) = x loves y.
• star(x) = x is a football star.
• student(x) = x is a student
• pass(x) = x passes.
• play(x) = x plays.
• study(x) = x studies.
19
Question #13
Consider the following axioms:
4. Any coyote who chases some roadrunner but does not catch it is hungry.
• hungry(x) = x is hungry.
20
Question #14
Consider the following axioms:
1. Any passerby who gives a jacket to any homeless person is good-hearted.
2. Paula owns a jacket
3. Any jacket that Paula owns is given to her by Anna
4. Anna is a passerby
5. Paula is a homeless person
Prove that: Anna is good-hearted
Use the following predicates:
• passerby(x) = x is a passerby.
• gives(x, y, z) = x gives y to z.
• jacket(x) = x is a jacket.
• homeless(x) = x is a homeless person
• good(x) = x is good-hearted
• owns(x, y) = x owns y
Answer #14
Conversion to CNF
1. ENG: Any passerby who gives a jacket to any homeless person is good-
hearted.
FOL: ∀x ∀y ∀z (passerby(x) ∧ jacket(y) ∧ homeless(z) ∧ gives(x, y, z))
→ good(x)
CNF: ¬passerby(x1) ∨ ¬jacket(y1) ∨ ¬homeless(z1) ∨ ¬gives(x1, y1, z1)
∨ good(x1)
2. ENG: Paula owns a jacket.
FOL: ∃x jacket(x) ∧ owns(Paula, x)
CNF: jacket(J) ∧ owns(Paula, J)
3. ENG: Any jacket that Paula owns is given to her by Anna.
FOL: ∀x (jacket(x) ∧ owns(Paula, x)) → gives(Anna, x, Paula)
CNF: ¬jacket(x3) ∨ ¬owns(Paula, x3) ∨ gives(Anna, x3, Paula)
4. ENG: Anna is a passerby.
FOL: passerby(Anna)
CNF: passerby(Anna)
5. ENG: Paula is a homeless person.
FOL: homeless(Paula)
CNF: homeless(Paula)
21
Negating the Conclusion
ENG: Anna is good-hearted
FOL: good(Anna)
CNF: good(Anna)
NEG: ¬good(Anna)
List of Clauses
1. ¬passerby(x1) ∨ ¬jacket(y1) ∨ ¬homeless(z1) ∨ ¬gives(x1, y1, z1) ∨ good(x1)
2A. Jacket(J)
2B. owns(Paula, J)
3. ¬jacket(x3) ∨ ¬owns(Paula, x3) ∨ gives(Anna, x3, Paula)
4. passerby(Anna)
5. homeless(Paula)
6. ¬good(Anna)
Performing Resolution
Combine 6 & 1, substitute x1 = Anna, we get:
7. ¬passerby(Anna) ∨ ¬jacket(y1) ∨ ¬homeless(z1) ∨ ¬gives(Anna, y1, z1)
Combine 2A & 3, substitute x3 = J, we get:
8. ¬owns(Paula, J) ∨ gives(Anna, J, Paula)
Combine 8 & 2B, we get:
9. gives(Anna, J, Paula)
Combine 9 & 7, substitute y1 = J, z1 = Paula, we get:
10. ¬passerby(Anna) ∨ ¬jacket(J) ∨ ¬homeless(Paula)
Combine 10 & 5, we get:
11. ¬passerby(Anna) ∨ ¬jacket(J)
Combine 11 & 2A, we get:
12. ¬passerby(Anna)
Combine 12 & 4, we get:
13. ϕ
22