I have those predicate:
% 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).
I need to write predicate noPhysicsNorChemistryStudents(Name , Department , Year , Town)/4
:
find all students' name who not learn physics or chemistry.
I don't know how to write it. I think it should be something with cut.
% Signature: noPhysicsNorChemistryStudents(Name , Department , Year , Town)/4
Why this is not true? :
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 .