我有那些谓词:
% Signature: student(ID, Name, Town , Age)/4
% Purpose: student table information
student(547457339, riki, beerSheva , 21).
student(567588858, ron, telAviv , 22).
student(343643636, vered, haifa , 23).
student(555858587, guy, beerSheva , 24).
student(769679696, smadar, telAviv , 25).
% Signature: study(Name, Department , Year)/3
% Purpose: study table information
study(riki, computers , a).
study(ron, mathematics , b).
study(vered, computers , c).
study(riki, physics , a).
study(smadar, mathematics , c).
study(guy, computers , b).
% Signature: place(Department ,Building, Capacity)/3
% Purpose: place table information
place(computers , alon , small).
place(mathematics , markus , big).
place(chemistry , gorovoy , big).
place(riki, zonenfeld , medium).
我需要写谓词noPhysicsNorChemistryStudents(Name , Department , Year , Town)/4
:找出所有没有学物理或化学的学生的名字。我不知道怎么写。我认为它应该是有切割的东西。
% Signature: noPhysicsNorChemistryStudents(Name , Department , Year , Town)/4
为什么这不是真的?:
noPhysicsNorChemistryStudents2(Name , Department , Year , Town) :-
student(_, Name, Town, _), study(Name , Department , Year),
pred1(Name , physics , Year ) , pred1(Name , chemistry , Year ).
pred1(N,D ,Y):- study(N , D , Y ) , ! , fail .