Logic Programming
What
versus
How
 

Assignment - Program Sheets


The purpose of this exercise is for you to become familiar with the encoding of logical rules that define legality and illegality of a given state of affairs.

The world here is a simplified version of the academic program sheet introduced in Lesson 1. implemented as a worksheet with various choices of courses for a student to take. The user's goal in filling out this form is to specify courses that meet his interests while satisfying all academic requirements and not spending too much time in the program.

The program sheet contains the academic requirements in two forms. They are listed on the form in English, and they are encoded as rules that are not visible on the form. The rules are the basis for the dynamic behavior of the program sheet. As the user checks various courses, the English encoding of the requirements changes color. Black means that the requirement is satisfied; red means the requirement is not satisfied.

To see the desired behavior, load the finished program sheet and play around with it a bit. The Test Data button shows a sample way of filling in the form that satisfies all constraints. The Clear Data button at the bottom empties the sheet.

Once you get a sense of the desired behavior, load the modifiable program sheet. This one looks like the finished sheet, but it does not behave the same. Your job is to add, modify, or delete rules to make the modifiable sheet behave in the same way as the finished sheet. Luckily, this version contains two additional features to help you with this task.

Below the sheet on the left is a box that shows the data corresponding to the current state of the checkboxes. As you check and uncheck boxes, the data in this box changes. Note that you cannot modify this data directly. You can change it only by checking and unchecking checkboxes.

Below the sheet on the right is a box containing the rules currently associated with the program sheet. Unlike the situation with the data box, you can modify the rules shown here. Simply click in the box and edit the rules shown there. Once you are happy with your rule set, click outside the box and the new rules will take effect.

Your job in this exercise is to write rules that formalize the hypothetical requirements described in English on the program sheet and thereby make the program behave like the finished program sheet. The requirements are listed in the rules box, and your job is to define the satisfied relation for each of the requirements. Once you have done this, you should submit your rules to the teaching assistant and/or demonstrate your revised program sheet.

Suggestion: You might want to keep a copy of your rules in a file somewhere. That way, when you load up a new starter program sheet, you can cut and paste them into the Rules box rather than typing them in all over again.

Submission Details. When you are done with the assignment, copy and paste your rules into an email and send to the Teaching Assistant. We will evaluate your rules on the basis of correctness (i.e. no syntactic errors, safety, and stratification) and efficacy (whether or not they adequately encode program requirements listed on the program sheet).