I’m using: SWI-Prolog version 7.6.4
I have a list containing variables and atoms. The variables can also be inside a “not”. The predicate assign should bind true/false to them.
Query:
assign([true,false,X,not(Y)]).
One Solution I get:
X = not(true),
Y = true
I don’t want to get not(true) or not(false) as possible solutions. Instead I want to have only true/false as possible assignments.
My code looks like this:
assign([]).
assign([not(H)|T]) :-
var(H),
bind(H),
assign(T).
assign([H|T]) :-
var(H),
bind(H),
assign(T).
assign([H|T]) :-
ground(H),
assign(T).
bind(true).
bind(false).