q1a(X) :- parts(_,X,_,P,_), P < 20. answer1a(L) :- setof([X],q1a(X),L). q1b(X,Y) :- employees(E,X,Z,_), orders(O,_,E,_,_), odetails(O,P,_), parts(P,_,_,N,_), N > 50, zipcodes(Z,Y). answer1b(L) :- setof([X,Y],q1b(X,Y),L). q1c(X,Y) :- customers(X,_,_,Z,_), customers(Y,_,_,Z,_), X < Y. answer1c(L) :- setof([X,Y],q1c(X,Y),L). q1d(X) :- customers(C,X,_,_,_), orders(_,C,E,_,_), employees(E,_,Z,_), zipcodes(Z,'Wichita'). answer1d(L) :- setof([X],q1d(X),L). q1e_temp1(X) :- orders(_,X,_,_,_). q1e_temp2(X) :- employees(E,_,Z,_),orders(_,X,E,_,_),zipcodes(Z,C), C \== 'Wichita'. q1e(X) :- customers(C,X,_,_,_), q1e_temp1(C), not q1e_temp2(C). answer1e(L) :- setof([X],q1e(X),L). q1f_temp1(X,Y) :- customers(X,_,_,_,_), parts(Y,_,_,P,_), P < 20. q1f_temp2(X,Y) :- orders(O,X,_,_,_),odetails(O,Y,_),parts(Y,_,_,P,_), P < 20. q1f_temp3(X) :- q1f_temp1(X,Y), not q1f_temp2(X,Y). q1f(X) :- customers(C,X,_,_,_), not q1f_temp3(C). answer1f(L) :- setof([X],q1f(X),L). q1g_temp1(X) :- customers(C,_,_,Z,_), employees(X,_,Z,_), orders(_,C,X,_,_). q1g_temp2(X) :- orders(_,_,X,_,_). q1g_temp3(X) :- q1g_temp2(X), not q1g_temp1(X). q1g(X,Y) :- employees(X,Y,_,_), q1g_temp3(X). answer1g(L) :- setof([X,Y],q1g(X,Y),L). output([]) :- !. output([X|L]) :- write(X), nl, output(L). go1 :- tell(f1), answer1a(L1),write('Answer to Q1a'), nl,output(L1), nl, answer1b(L2),write('Answer to Q1b'), nl,output(L2), nl, answer1c(L3),write('Answer to Q1c'), nl,output(L3), nl, answer1d(L4),write('Answer to Q1d'), nl,output(L4), nl, answer1e(L5),write('Answer to Q1e'), nl,output(L5), nl, answer1f(L6),write('Answer to Q1f'), nl,output(L6), nl, answer1g(L7),write('Answer to Q1g'), nl,output(L7), nl, told.