I'm writing a resolution prover in prolog, which takes inputs of the form
[[(a or b) equiv neg(c and d)]]
etc., and converts them into CNF. All logical operators work fine, but when the program attempts to expand an equiv
operation, brackets go missing. For example, performing one step of the algorithm on
[[(a and b) equiv c]]
gives the result
[[neg(a and b) or c], [neg c or a and b]]
In the second clause, the brackets around a and b
have been deleted, while they remain in the first clause. Why is this happening?
For reference, this is my code and the command giving that output is singlestep([[(a and b) equiv c]], X).
The specific code for how equiv
should be dealt with is at line 93, and the function singlestep
is at line 108.