
/* Adapted from Clocksin, W.F., Mellish, C.S., "Programming in Prolog"
   (3rd Ed.) Springer-Verlag, 1987 */

client('bob').
client('dwight').

staff('bob').

/* Allow staff to have overdue books */
/* book_overdue(X,_):-staff(X),!,fail. */

book_overdue('bob', book100).

general_facility(X) :- basic_facility(X).
general_facility(X) :- additional_facility(X).

additional_facility(borrowing).
additional_facility(inter_library_loan).

basic_facility(references).
basic_facility(enquires).


facility(Person, Facility) :-
        book_overdue(Person, Book),
        !,                        
        basic_facility(Facility).

/* Allow staff to have overdue books: better alternative using NAF */

/*
facility(Person, Facility) :-
        \+ staff(Person),
        book_overdue(Person, Book),
        !,                              
        basic_facility(Facility).
*/

facility(Person, Facility) :- general_facility(Facility).

/* Try  :-client(X),facility(X,Y). */
