CS Behind the Curtain (CS195 2003S)

Homework 2: Evaluating Boolean Propositions

Summary: In this assignment, you will develop a program that shows the steps involved in evaluating a Boolean proposition in a particular state.

Assigned: Wednesday, 22 January 2003.

Due: Tuesday, 28 January 2003.

Collaboration: You may work in groups of up to size three. You may also work alone.

Formatting Guidelines:

Submitting Your Work: Submit your source code with the ECA. If you can't get it to work, email me your source code.


Write (in Scheme or Java) a program that takes a Boolean expression (fully parenthesized, in infix form) and a state (a mapping of variable names to true or false) and shows the steps in evaluating that expression.

Your program need not be efficient. For example, here's a sketch of one technique

Replace all variables in P by the corresponding values
while P is neither true nor false
  Print P
  Find the innermost non-trivial sub-proposition
  Replace that sub-proposition by its value



Wednesday, 22 January 2003 [Samuel A. Rebelsky]


Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Fri May 2 14:19:34 2003.
The source to the document was last modified on Wed Jan 22 14:02:58 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS195/2003S/Homework/hw.02.html.

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Samuel A. Rebelsky, rebelsky@grinnell.edu