i'm stuck on a timetable clash question. Given these rules, I need to see if there is a student that is enrolled in two separate classes that has a class on the same day and time using the the predicate clash/1.
student(alice).
student(bob).
student(claire).
student(don).
enrolled(alice, logic).
enrolled(alice, maths).
enrolled(bob, maths).
enrolled(claire, physics).
enrolled(don, logic).
enrolled(don, art_history).
class(logic, monday, 10).
class(logic, wednesday, 10).
class(maths, tuesday, 14).
class(maths, thursday, 14).
class(physics, wednesday, 10).
class(physics, friday, 14).
class(art_history, monday, 10).
class(art_history, friday, 10).
Currently I have this:
clash(Student):- enrolled(Student, X), enrolled(Student, Y),
class(X, A, B), class(Y, C, D), A = C, B = D.
But I can't get it to work, any suggestions on solving this or guidance on if i'm doing something wrong?