You are on page 1of 22

CSE 3005: First Order Resolution Exercises

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:

1. Lulu is the mother of Fifi


2. Lulu is alive
3. Anyone is who the mother of someone, is also their parent.

4. Everyone’s parents who are also alive, are older than them.

Prove that: Lulu is older than Fifi.


Use the following predicates:
• mother(x, y) = x is the mother of y.
• alive(x) = x is alive.
• parent(x, y) = x is the parent of y.

• older(x, y) = x is older than y.

Answer #1
Conversion to CNF:
1. ENG: Lulu is the mother of Fifi
FOL: mother(Lulu, Fifi)
CNF: mother(Lulu, Fifi)

2. ENG: Lulu is alive


FOL: alive(Lulu)
CNF: alive(Lulu)
3. ENG: Anyone is who the mother of someone, is also their parent.
FOL: ∀x mother(x, y) → parent(x, y)
CNF: ¬mother(x3, y3) ∨ parent(x3, y3)
4. ENG: Everyone’s parents who are also alive, are older than them.
FOL: ∀x ∀y (parent(x, y) ∧ alive(x)) → older(x, y)
CNF: ¬parent(x4, y4) ∨ ¬ alive(x4) ∨ older(x4, y4)

Negating the Conclusion


Conclusion: Lulu is older than Fifi.
FOL: older(Lulu, Fifi)
CNF: older(Lulu, Fifi)
NEG: ¬older(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)

Performing the Resolution:


Combine 5 & 4, substitute x4 = Lulu, y4 = Fifi, we get:
6. ¬parent(Lulu, Fifi) ∨ ¬ alive(Lulu)
Combine 6 & 3, substitute x3 = Lulu, y3 = Fifi, we get:
7. ¬mother(Lulu, Fifi) ∨ alive(Lulu)
Combine 7 & 2, we get:
8. ¬mother(Lulu, Fifi)
Combine 8 & 1, we get:
9. ϕ

3
Question # 2
Consider the following statements:

1. If something is intelligent, it has common sense.


2. Deep Blue does not have common sense.

Prove that: Deep Blue is not intelligent.


Use the following predicates:

• 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)

Negating the Conclusion:


Deep Blue is not intelligent.
FOL: ¬intelligent(Deep Blue)
CNF: ¬intelligent(Deep Blue)
NEG: intelligent(Deep Blue)

Listing the clauses:


The following are the clauses:
1. ¬intelligent(x1) ∨ commonSense(x1)
2. ¬commonSense(Deep Blue)
3. intelligent(Deep Blue)

Performing the Resolution:


Combining 1 & 2, substitute x1 = Deep Blue, we get:
4. ¬intelligent(Deep Blue)
Combining 3 & 4, we get:
5. ϕ

4
Question #3
Consider the following statements:

1. Anyone who has allergies will sneeze.


2. If anyone has a cat, but is also allergic to cats, then they have allergies.
3. Mary is allergic to cats.

4. Mary has a cat named Felix

Prove that: Mary sneezes.


Use the following predicates:
• allergies(x) = x has allergies.
• sneeze(x) = x sneezes.
• cat(x, y) = x has a cat named y.

• allergicToCats(x) = x is allergic to cats.

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)

Negating the Conclusion:


ENG: Mary sneezes.
FOL: sneeze(Mary).
CNF: sneeze(Mary)
NEG: ¬sneeze(Mary)

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)

Performing the Resolution:


Combine 5 & 1, substitute x1 = Mary, we get:
6. ¬allergies(Mary)
Combine 6 & 2, substitute x2 = Mary, we get:
7. ¬cat(Mary, Felix) ∨ ¬allergicToCats(Mary)
Combine 7 & 3, we get:
8. ¬cat(Mary, Felix)
Combine 8 & 4, we get:
9. ϕ

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)

Negate the Conclusion


ENG: If John is a light sleeper, then John does not have any mice.
FOL: LS(John) → (∀x mouse(x) → ¬has(John, x))
CNF: ¬LS(John) ∨ (¬mouse(x) ∨ ¬has(John, x))
NEG: LS(John) ∧ mouse(x) ∧ has(John, x)

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)

Performing the Resolution


Combine 5A & 3, substitute x3 = John, we get:
6. ¬howl(y3) ∨ ¬has(John, y3)
Combine 6 & 1, substitute y3 = x1, we get:
7. ¬has(John, x1) ∨ ¬hound(x1)
Combine 2 & 4A, substitute y2 = P, x2 = John, we get:
8. hound(P) ∨ ¬has(John, P) ∨ ¬mouse(z2) ∨ ¬has(John,z2)
Combine 8 & 4B, we get:
9. hound(P) ∨ ¬mouse(z2) ∨ ¬has(John,z2)
Combine 9 & 5B, substitute z2 = x5, we get:
10. hound(P) ∨ ¬has(John, x5)
Combine 10 & 5C, we get:
11. hound(P)
Combine 7 & 11, substitute x1 = P, we get:
12. ¬has(John, P)
Combine 12 & 4B, we get:
13. ϕ

8
Question #5
Consider the following axioms:

1. Marcus was a man.


2. Marcus was a Roman.
3. All men are people.

4. Caesar was a ruler.


5. All Romans were either loyal to Caesar or hated him.
6. Everyone is loyal to someone.
7. People only assassinate rulers that they are not loyal to.

8. Marcus assassinated Caesar.

Prove that: Marcus hated Caesar.


Use the following predicates:
• man(x) = x is a man
• Roman(x) = x is a Roman

• 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)

Negating the Conclusion:


ENG: Marcus hated Caesar.
FOL: hate(Marcus, Caesar)
CNF: hate(Marcus, Caesar)
NEG: ¬hate(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:

1. Anyone who rides a motorbike is a thug.


2. Every biker rides either a motorbike or a BMW.
3. Anyone who rides a BMW is a lawyer.

4. Any nice girl does not like a thug.


5. Mary is a nice girl and Jim is a biker.

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.

4. Anyone who is lucky wins the lottery.

Prove that: John is happy.


Use the following predicates:
• passes(x) = x passes his exam
• wins(x) = x wins the lottery
• studies(x) = x studies

• 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)

Negating the Conclusion


ENG: John is happy.
FOL: happy(John)
CNF: happy(John)
NEG: ¬happy(John)

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)

Performing the Resolution


Combine 5 & 1, substitute x1 = John, we get:
6. ¬passes(John) ∨ ¬wins(John)
Combine 6 & 4, substitute x4 = John, we get:
7. ¬passes(John) ∨ ¬lucky(John)
Combine 7 & 2B, substitute x2 = John, we get:
8. ¬lucky(John)
Combine 8 & 3B, we get:
9. ϕ

14
Question #8
Consider the following axioms:

1. Anyone who can read is not stupid.


2. Anyone who is not poor and is not stupid is also happy.
3. John can read and is not poor.

4. Happy people have exciting lives.

Prove that: John is happy.


Use the following predicates:
• read(x) = x can read.
• stupid(x) = x is stupid.
• poor(x) = x is poor.

• happy(x) = x is happy.
• exciting(x) = x has an exciting life.

15
Question #9
Consider the following axioms:

1. Tony, Tom and Liz are members of the Adventure Club.


2. Every member of the Adventure Club is either a mountain climber, a skier,
or both.

3. No mountain climber likes rain.


4. All skiers like snow.
5. Liz likes whatever Tony dislikes and dislikes whatever Tony likes.
6. Tony likes rain and snow.

Prove that: Liz is a mountain climber, but not a skier.


Use the following predicates:

• member(x) = x is a member of the Adventure Club.


• climber(x) = x is a climber
• skier(x) = x is a skier
• likes(x, y) = x likes y

• dislikes(x, y) = likes(x, y) = x dislikes y.

16
Question #10
Consider the following axioms:

1. The only animals in the house are cats.


2. Every animal who loves to gaze at the moon is suitable as a pet.
3. When I hate an animal, I avoid it.

4. All carnivorous animals prowl at night.


5. All cats kill mice.
6. If an animal ever likes me, then it is in this house.
7. Kangaroos are not suitable as pets.

8. Any animal that kills mice is carnivorous.


9. I hate animals that do not like me.
10. Animals that prowl at night always love to gaze at the moon.

Prove that: I avoid kangaroos.


Use the following predicates:

• house(x) = x is in the house.


• cat(x) = x is a cat.

• gaze(x) = x loves to gaze at the moon.


• pet(x) = x is suitable as a pet.
• hate(x) = I have x.
• avoid(x) = I avoid x.

• carnivorous(x) = x is a carnivorous animal.


• prowl(x) = x prowls at night.
• kill(x) = x kills mice.

• likes(x) = x likes me.

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.

3. Mary buys carrots by the bushel.


4. Anyone who owns a rabbit hates anything that chases any rabbit.
5. John owns a dog.
6. Someone who hates something owned by another person will not date that
person.

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:

1. Anyone whom Mary loves is a football star.


2. Any student who does not pass does not play.
3. John is a student.

4. Any student who does not study does not pass.


5. Anyone who does not play is not a football star.

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:

1. Every coyote chases some roadrunner.


2. Every roadrunner who says “beep-beep” is smart.
3. No coyote catches any smart roadrunner.

4. Any coyote who chases some roadrunner but does not catch it is hungry.

Prove that: If all roadrunners say “beep-beep”, every coyote is hungry.


Use the following predicates:
• coyote(x) = x is a coyote.
• RR(x) = x is a roadrunner.
• chase(x, y) = x chases y.

• beepBeep(x) = x says “beep-beep”.


• smart(x) = x is smart.
• catch(x, y) = x catches y

• 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

You might also like