本次java任务是对文件中的数据进行解析
Project 2
First deliverable (p1a, 5 points): F 10/11 @ 5 PM
Second deliverable (p1b, 5 points): F 10/25 @ 5 PM
Final deliverable (p1c, 20 points): F 11/15 @ 5 PM
30 points total
I have divided the project into three deliverables:
1. Write a program and the classes and methods necessary to read, parse, store, and output first-order well-formed
formulas (wffs). Formulas must be stored internally as expression trees.
The following grammar specifies the syntax for wffs.
formula ::= ‘(‘ predicate-name argument-list ‘)’
|
|
|
|
|
|
‘(‘ ‘not’ formula ‘)’
‘(‘ ‘or’ formula formula ‘)’
‘(‘ ‘and’ formula formula ‘)’
‘(‘ ‘cond’ formula formula ‘)’
‘(‘ ‘forall’ variable formula ‘)’
‘(‘ ‘exists’ variable formula ‘)’
predicate-name ::= identifier
argument-list ::= argument arguments
arguments ::= argument arguments | ε
argument ::= function-or-constant-or-variable
function-or-constant-or-variable ::= function | constant | variable
function ::= ‘(‘ function-name argument-list ‘)’
function-name ::= identifier
identifier ::= letter letters-and-digits
constant ::= constant-letter letters-and-digits
|
variable-letter letter letters-and-digits
constant-letter ::= ‘a’..’t’ | ‘A’..’Z’
variable ::= variable-letter | variable-letter digits
variable-letter ::= ‘u’..’z’
digits ::= digit digits | ε
letters-and-digits ::= letter-or-digit letters-and-digits | ε
letter-or-digit ::= letter | digit
letter ::= ‘a’..’z’ | ‘A’..’Z’
digit ::= ‘0’..’9′
Examples of wffs written in this syntax are:
Jack owns a dog
&
(exists x (and (dog x) (owns jack x)))
All cats are animals
(forall x (cond (cat x) (animal x)))
No animal lover kills an animal
(forall x (cond (animallover x) (forall y (cond (animal y) (not (kills x
y))))))
To support development, I have created files for two proofs that appear in Russell and Norvig, the proof that Curiosity
did not kill the cat and the proof that Colonel West is a criminal. 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 Curiosity and West proofs, you must find two additional proofs from reputable sources consisting of at
least four formulas and three predicates. Naturally, I will test your program on my own set of proofs.
For the first deliverable, Main.mainin Main.javashould take a file name as a command-line argument. For each
formula in the file, the program must parse it, store it as an expression tree, and print the string representation of the
expression tree to the console.
You must implement the class Formulawith the methods
public Formula();
public void set( String s );
public String toString();
In addition to calling Main.main, the autograder will call these three methods.
Include with your submission the two 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
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 program for grading, create a zip file named submit.zipcontaining your project’s
source files, proof files, transcript, and honor statement.
2
. Implement the routines to convert wffs to clausal form. For the second deliverable, you must produce a single
executable that takes a file name as a command-line argument. For the formulas in the file, the program must read and
store them, print them to the console, convert them to clausal form, store them as expression trees, and print them to
the console. Include with your submission the proof files and a transcript of your program’s execution on the four files.
You must implement
public void Formula.cnf(), which converts a formula to conjunctive normal form
public Clauses Formula.getClauses(), which converts a formula to clausal form and returns the
resulting clauses
public class Clauses, which simply extends ArrayList<Clause>
public String Clause toString(), which returns the string representation of the clause
The prefix for Skolem constants must be sc. The prefix for Skolem functions must be sf.
in a zip file named submit.zip.
3. Implement the routines to required to conduct resolution proofs using linear resolution.
For the final deliverable, you must produce a single executable that takes a file name as a command-line argument.
The program should read the formulas in the file and conduct a proof using linear resolution. The program should print
2
/3
the formulas, the converted clauses, and a trace of the proof consisting of each clause Ci its resolvents from Δ and S.
Finally, it should print a message indicating whether it was able to derive the conclusion from the premises.
You must also implement
public void Clause().
public void Clause.set( String ), which sets the Clauseto the clause that the specified String
represents.
public Clauses Clauses.resolve( Clause clause ), which resolves all of the clauses in Clauses
with the Clauseclauseand returns them.
public static boolean LinearResolution.prove( String filename ), which returns trueif the
conclusion follows from the premises and returns falseotherwise.
Include with your submission the proof files and a transcript of your program’s execution on the four files.
in a zip file named submit.zip.
3
/3
程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB

本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易!
E-mail: [email protected]k.com 微信:itcsdx
如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。
