% INTRO TO LOGIC PROGRAMMING AND AI % Spring 1998 % //Selmer Bringsjord % % The "mini jobs puzzle" runs as follows: %============= % Roberta and Steve hold, between them, two jobs. Each has one job. % The jobs are teacher and nurse. The job of nurse is held by a male. % Who holds which jobs? %============= % % set(auto). assign(max_proofs,-1). formula_list(usable). % Everybody is employed: all x (Job(x,nurse) | Job(x,teacher)). % Nurses are males: all x (Job(x,nurse) -> Male(x)). % Everybody is male or female; no one is both: all x ( (Female(x) | Male(x)) & -(Female(x) & Male(x))). %Roberta is a female and Steve is a male: Female(roberta). Male(steve). % Steve and Roberta are distinct: steve != roberta. % If x is a teacher and y is diverse from x, then y is a nurse, and % y isn't a teacher: all x all y ( (Job(x,teacher) & x != y) -> Job(y,nurse)). all x all y ( (Job(x,teacher) & x != y) -> -Job(y,teacher)). % If x is a nurse and y is diverse from x, then y is a teacher, and % y isn't a nurse: all x all y ( (Job(x,nurse) & y != x) -> Job(y,teacher)). all x all y ( (Job(x,nurse) & y != x) -> -Job(y,nurse)). % -(Job(roberta,teacher)). -(Job(steve,nurse)). %-(Job(steve,nurse)). % -Job(x,y) | Info(x,y). end_of_list. % Templates to have ready for conversion to "database" version of % the problem. % % list(sos). % % % end_of_list. % list(passive). % -Info(x,y) | $ANSWER(hasjob(x,y)). % end_of_list.