CS 289, Fall 2004
Assignment 1: Propositional Reasoning, due 9/27




This assignment to be done in pairs.

  1. We proved in class that forward chaining is complete for atoms---every entailed atom is derived.
    1. First, modify the algorithm so that it can decide whether any given definite clause is entailed by any definite clause KB. Prove that your new algorithm is complete for definite clauses.
    2. Now, repeat these steps for entailment of arbitrary CNF sentences by a definite clause KB.
  2. Complete the completeness proof for resolution on p.217 of AIMA2e.
  3. This exercise is concerned with implementing and testing DPLL.
    1. Define data structures for sentences of propositional logic, for sentences in CNF, and for models. (Hint: use integers for variables.) Write a function for evaluating the truth of a propositional logic sentence in a model.
    2. Implement the DPLL algorithm as efficiently as possible. Your code should use (at least) incremental assignment/unassignment of variables and indexing structures that allow efficient detection of pure literals and unit clauses.
    3. Write a function for generating random 3-SAT problems with m clauses, such that each clause is constructed by selecting k variables at random (no duplicates) and negating each with 50% probability.
    4. Run sufficient experiments to reproduce the graphs in Figure 7.18 of AIMA2e, with the following modifications: the runtime plot need not include WalkSAT, there should be two curves for DPLL, one for satisfiable and one for unsatisfiable problems, and you should try for the largest number of variables you can manage. (Note that the graph shows median rather than average runtime. Can you take advantage of this to speed up your experiments?) You may need to generate extra problems in the high and low satisfiability regions to reduce variance in your data.
    5. Experiment with randomization in the selection of variables for splitting in DPLL, combined with random restarts. Does this improve runtime on hard random 3-SAT instances?
  4. Do Exercise 7.11, parts a-e.
  5. (Optional) Using your DPLL implementation, construct a logical Minesweeper agent. The agent should play in logically safe squares whenever possible, otherwise it should choose a square uniformly at random. Plot the agent's success rate as a percentage of the number of mines M, for the largest square board your algorithm can handle. Some lisp code for playing minesweeper is available here.