Your job in this assignment is to implement two automatic proving methods for propositional logic, based on a text file that holds a knowledge base as a list of clauses and a query given as another command-line argument. Your job is to implement both backward chaining and the resolution method. In the case of backward chaining, you can assume that the clauses in the knowledge base are definite Horn clauses, because this is what backward chaining requires. In the case of the resolution method, the clauses can be arbitrary disjunctions of literals.
-A B
-B -A C
A
KB
, and that the query proposition is B
. Then, given the command-line: java BackwardChaining KB B
your program must output Knowledge base entails proposition
. If the knowledge base does not entail the proposition it must output Knowledge base does not entail proposition
. As mentioned above, you can assume that the knowledge base consists of definite Horn clauses, i.e. clauses that have exactly one positive literal (because this is what backward chaining requires). Furthermore, you can assume that the last literal in the definition of a clause is always the positive literal.
Contradiction found
or No contradiction found
. For example, the command-line: java Resolution KB "-A -C"
must give the output Contradiction found
for the knowledge base given above (which means the negation of the given clause, A /\ C, is entailed by the knowledge base).
Value: 11% of the final grade
Due date: Wednesday, 9 April, midday
No extensions will be granted except for sound, documented, medical reasons.