我是PROLOG的新手,并且正处于本页练习的最开始阶段.给定父(X,Y)和男(X)的规则,我试图将规则母(X,Y)定义为
mother(X, Y) :-
not(male(X)),
parent(X, Y).
Run Code Online (Sandbox Code Playgroud)
但是,在GNU Prolog中我收到以下错误:
| ?- mother(lina, julia).
uncaught exception: error(existence_error(procedure,not/1),mother/2)
| ?-
Run Code Online (Sandbox Code Playgroud)
该解决方案实际上位于该页面上的练习文件中:
female(X) :- \+ male(X).
Run Code Online (Sandbox Code Playgroud)
正如@Mog所说,否定是一元运算\+符.