I understand that the \+
symbol in Prolog stands for "not provable", which evaluates to false if some clause is provable.
This got me thinking about the reversibility of a Rule's logic, is there a way to reverse a rules logic that uses similar syntax to the \+
symbol given above? i.e. that doesn't require you changing the clause itself.
By reverse I mean the rule's logic is inverted. For example, if the rule is X > Y
, then the reverse returns the outcome X < Y
.
For a more complex example, imagine, instead, I had the clause:
passed(X, Y) :- mark(X, Y, Z), Z >= 40.
mark(john, maths, 50).
mark(paul, maths, 10).
mark(harry, maths, 78).
Could I reverse the following statement:
?- passed(X, maths).
X = john
X = harry
So that I get:
X = paul