The Department of Computer Science & Engineering
 UB CSE 4/563 Documentation

CSE 4/563: Knowledge RepresentationStuart C. Shapiro Fall, 2010 System Documentation

Alphabetical List of Languages and Systems Covered
Common Lisp
Discrete Event Calculus Reasoner (decreasoner)
GSAT
Prolog
Prover
Relsat
SNARK
SNePS
Walksat
Wang

Common Lisp

Prolog

Prover, a Pedagogical Resolution Theorem Prover
• To run the prover:
1. Run Common Lisp on timberlake.cse.buffalo.edu or nickelback.cse.buffalo.edu.
2. :ld /projects/shapiro/AIclass/prover
3. :pa prover
4. Try (prove <list of assumption wffs> <wff to be proven>),
for example, (prove '( p (if p q) ) 'q)
• For instructions, see /projects/shapiro/AIclass/prover.cl

SNARK
• Mark E. Stickel, SNARK - SRI's New Automated Reasoning Kit
• Mark E. Stickel, Richard J. Waldinger, & Vinay K. Chaudhri A Guide to SNARK
• The language in which SNARK formulas may be expressed is described in A Guide to SNARK, Sect. 2.1.1
• To run SNARK on UB CSE Department computers:
1. Run Common Lisp on timberlake.cse.buffalo.edu or nickelback.cse.buffalo.edu.
2. :ld /projects/shapiro/CSE563/snark
3. :pa snark-user
4. (initialize)
5. Assert some wffs, then ask for a proof, for example,
(assert 'p)
(assert '(=> p q))
(prove 'q)

• To use the ask and query front-ends to SNARK:
1. Run Common Lisp on timberlake.cse.buffalo.edu or nickelback.cse.buffalo.edu.
3. :pa snark-user
4. (initialize)
5. Assert some wffs, then ask a question, for example,
(assert 'p)
(assert '(=> p q))
(query "Is q true, false, or unknown?" 'q)

SNePS

Wang Algorithm (Semantic Tableaux)
1. Run Common Lisp on timberlake.cse.buffalo.edu or nickelback.cse.buffalo.edu.
2. :ld /projects/shapiro/CSE563/wang
3. Use one of the functions:
• wang:wang
• wang:entails
• wang:predicate-wang
• wang:predicate-entails
4. See instructions, including syntax, in /projects/shapiro/CSE563/wang.cl
5. Trace the function wang:wang by evaluating (trace wang:wang) to see how it operates.

GSAT
Original Paper
Bart Selman, Hector Levesque and David Mitchell, A New Method for Solving Hard Satisfiability Problems, Proceedings AAAI-92.
Instructions
1. Run Common Lisp on timberlake.cse.buffalo.edu or nickelback.cse.buffalo.edu.
2. :ld /projects/shapiro/CSE563/gsat
3. :pa gsat
4. Try any of
• (gsat wffs tries flips)
• (gsat wffs tries flips :trace t)
• (ask wff KB tries flips)
• (ask wff KB tries flips :trace t)
5. See the example in /projects/shapiro/CSE563/Examples/GSAT/gsat.cl

Walksat
Relsat is the stochastic solver used by the version of the Discrete Event Calculus Reasoner installed at UB CSE.
• Instructions:
• Walksat runs on timberlake.cse.buffalo.edu and nickelback.cse.buffalo.edu.
• The program is /projects/shapiro/CSE563/WalkSAT/Walksat_v46/walksat
• Input can be from standard input or a file.
• Input must follow the DIMACS CNF format.
• Output can be to standard output or a file.
• Enter the Unix command /projects/shapiro/CSE563/WalkSAT/Walksat_v46/walksat -help to see the command line options.
• For an example try,
/projects/shapiro/CSE563/WalkSAT/Walksat_v46/walksat -solcnf < /projects/shapiro/CSE563/Examples/Walksat/cpw.cnf

Relsat
Relsat is the systematic solver used by the version of the Discrete Event Calculus Reasoner installed at UB CSE. Some references are:

Discrete Event Calculus Reasoner
• User Manual: Erik T. Mueller, Discrete Event Calculus Reasoner Documentation, March 2, 2008. (HTML version)
• Eric T. Mueller Commonsense Reasoning, Morgan Kaufmann, 2006.
• Example input files are in /projects/shapiro/CSE563/decreasoner/examples/
and /projects/shapiro/CSE563/decreasoner/examples/ShapiroCSE563/
• Instructions:
1. Decreasoner runs on both timberlake.cse.buffalo.edu and nickelback.cse.buffalo.edu.
2. cd /projects/shapiro/CSE563/decreasoner

3. Propositional Logic
• To take input from file and have output printed on your screen:
python ubdecreasonerP.py file

• or to take input from infile and have output put in outfile
python ubdecreasonerP.py infile > outfile

• Syntax of the input file for decreasonerP.py:
• A comment starts with the character ";" and extends to the end of the line.
• Blank lines are permitted anywhere in the file.
• Each atomic proposition must be introduced by a line:
proposition Symbol [comment]

• Where a Symbol "consists of (a) one or more digits or (b) an uppercase letter followed by zero or more letters or digits." [Erik T. Mueller, Discrete Event Calculus Reasoner Documentation, March 2, 2008.]
• After the atomic propositions are introduced, comes a sequence of wfps, each terminated with a period, and optionally followed by a comment, where the syntax of a wfp is:
wfp ::= Symbol
| ! wfp
| wfp & wfp
| wfp | wfp
| wfp -> wfp
| wfp <-> wfp
| (wfp)

Predicate Logic
• To take input from file and have output printed on your screen:
python ubdecreasoner.py file

• or to take input from infile and have output put in outfile
python ubdecreasoner.py infile > outfile