#### CS 662: AI Programming Homework #4: Logic

30 points.

Assigned: October 11

Due: October 18.

To turn in: Typed or clearly handwritten answers to the questions throughout the homework. (Note: if you have messy handwriting, please type your answers. If we can't read what you've written, we can't grade it.)

Propositional logic:

In this problem, you'll use propositional logic to reason about a simple world containing two robots and a charger. The problem is for each robot to determine whether it should move to the charger or not.

Abbreviations:

• R1: Robot1 is on.
• R2: Robot 2 is on.
• ChR1: Robot 1 is at the charger.
• ChR2: Robot 2 is at the charger.
• lowR1: Robot 1 has low power.
• lowR2: Robot 2 has low power.
• moveChR1: Robot 1 should move onto the charger.
• moveChR2: Robot 2 should move onto the charger.

A. (5 points). Write propositional logic sentences for each of the following English-language sentences, using the abbreviations above.
1. If robot 1 is off, then robot 2 is off.
2. If robot 2 is off, then it will be located on the charger, and if it is not off, then robot 2 will not be located on the charger.
3. If robot 1 is off, then it will be located on the charger, and if it is not off, then robot 1 will not be located on the charger.
4. If Robot 1 is on, and its power is low, then it should move to the charger.
5. Robot 1's power is low.
6. Robot 2 is on.

B. (10 points) Convert each of the sentences above to CNF.

C. (5 points) Use resolution with refutation to prove that Robot 1 should move to the charger.

First-order logic: (10 points) Translate each of the following sentences into first-order logic, using the following predicates: Student(x), likes(x,y), worksAt(x,y), childOf(x,y), livesIn(x,y)
• All the students like Bart.
• Unless a person is a student, that person works at the power plant.
• Marge Simpson has exactly two children: Bart and Lisa.
• There is someone is Springfield who is liked by everyone.
• Every student likes himself/herself.