COSC-270: Artificial Intelligence

Project 2
Fall 2019

Due: F 10/25 @ 5 PM
10 points

For this project, you will implement a resolution theorem prover for propositional logic.

I have divided the project into three phases:

  1. For the first phase, write the classes and methods necessary to read, parse, store, and output propositional well-formed formulas (wffs). Formulas must be stored internally as expression trees.

    The following grammar specifies the syntax for wffs.

    formula ::= '(' proposition ')'
             | '(' 'not' formula-or-proposition ')'
             | '(' 'or' formula-or-proposition formula-or-proposition ')'
             | '(' 'and' formula-or-proposition formula-or-proposition ')'
             | '(' 'cond' formula-or-proposition formula-or-proposition ')'
    
    formula-or-proposition ::= formula | proposition
    
    proposition ::= letter letters-and-digits
    
    letters-and-digits ::= letter-or-digit letters-and-digits | \epsilon
    
    letter-or-digit ::= letter | digit
    
    letter ::= 'a'..'z' | 'A'..'Z'
    
    digit ::= '0'..'9'
    

    Examples of wffs written in this syntax are:

    To support development, I have created files for two proofs that we discussed in lecture, the proof Example 1 and the proof that beggers do not ride horses. As you can see, comments begin with a forward slash, formulas begin with a left parenthesis, and both are confined to a single physical line. By convention, the last formula in the file is the conclusion.

    In addition to the these proofs, you must find two additional proofs from reputable sources consisting of at least three formulas and three propositions. Naturally, I will test your program on my own set of proofs.

    For this phase, you must implement the class Formula with the methods

    public Formula();
    public void set( String s );
    public String toString();
    
    When you submit to Autolab, the autograder will call these three methods. Naturally, you're free to implement additional methods.

  2. For the second phase, implement the routines to convert wffs to clausal form. Clauses must be stored internally as expression trees or more precisely a linked list of literals. The following grammar specifies the syntax for clauses.
    clause ::= '{' literals '}'
    
    literals ::= literal literals-comma-separated
    
    literals-comma-separated ::= ',' literal literals-comma-separated | \epsilon
    
    literal ::= proposition
             | '(' 'not' proposition ')'
    

    You must implement

  3. Finally, implement the routines to required to conduct proofs using resolution. For this final phase, you must implement Main.java so it takes a file name as a command-line argument. Main.main read the formulas in the file, negate the conclusion, convert the formulas to clausal form, and conduct a proof using resolution. The program should print the formulas, the converted clauses, a trace of the proof consisting of the successful resolutions, and a message indicating whether it was possible to derive the conclusion from the premises.

    You must implement

    Include with your submission the proof files and a transcript of your program's execution for the four proofs. In a file named HONOR, include the following statement:

    Name
    NetID
    
    In accordance with the class policies and Georgetown's Honor Code,
    I certify that, with the exceptions of the class resources and those
    items noted below, I have neither given nor received any assistance
    on this project.
    

    When you are ready to submit your project for grading, put your source files, Makefile, proof files, transcript, and honor statement in a zip file named submit.zip. Upload the zip file to Autolab using the assignment p2. Make sure you remove all debugging output before submitting.

Plan B

If Autolab is down, upload your zip file to Canvas.

Copyright © 2019 Mark Maloof. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.