I have this prolog file:
daughter(anna, vera).
daughter(vera, oleg).
daughter(olga, pavel).
daughter(olga, alla).
daughter(alla, lidia).
man(oleg).
man(victor).
man(pavel).
not(P) :- (call(P) -> fail ; true).
woman(X) :- not(man(X)).
?- woman(X).
always returns false. ?- man(X).
returns all three male entries though.
I also tried woman(X) :- \+man(X).
but certain syntax is not the problem it seems.
If I try to check a certain person it works: ?- woman(anna).
returns true.
I'm quite new to prolog and can't even suggest what is wrong here.
UPD. I want all people who are not men to be classified as men. The question is - why can't I do woman(X)
and get all non-men?
?- woman(anna).
true.
?- woman(X).
false.
?- man(X).
X = oleg ;
X = victor ;
X = pavel.
UPD2. Solution
The problem was caused by floundering as was pointed out in the comments. I needed woman(X)
rule to implement this rule: mothers_names(X, Y) :- not(man(X)), daughter(Y,X).
In a nutshell, inverting the query works: mothers_names(X, Y) :- daughter(Y,X), not(man(X)).
because first predicate makes X in not(man(X))
limited to several values.