% problem-set/puzzles/gen_test/interns.ver1.in % created : 07/27/88 % revised : 07/27/88 % description: % % This run solves "The Interns" puzzle using hyper-resolution. % % The Interns % % Three interns are residents of the same hospital. On only one % day of the week are all three interns on call. No intern is on % call on three consecutive days. No two interns are off on the % same day more than once a week. The first intern is off on % Sunday, Tuesday, and Thursday. The second intern is off on % Thursday and Saturday. The third intern is off on Sunday. % Which day of the week are all three interns on call? % representation: % % This version does has no denial. It terminates when sos becomes empty. set(UR_res). list(axioms). % Definition of all_on (4 clauses). -all_on(x) | on(a,x). -all_on(x) | on(b,x). -all_on(x) | on(c,x). all_on(x) | -on(a,x) | -on(b,x) | -on(c,x). % All are on exactly one day of the week (2 clauses). % All are on at least one day of the week, and all are on at most % one day of the week. all_on(Sun) | all_on(Mon) | all_on(Tue) | all_on(Wed) | all_on(Thu) | all_on(Fri) | all_on(Sat). -all_on(x) | -all_on(y) | same_day(x,y). % No one is on for 3 consecutive days. -consec(x,y) | -consec(y,z) | -consec(z,w) | -on(u,x) | -on(u,y) | -on(u,z). % No 2 interns are off on the same day more than once a week. on(x,y) | on(x,z) | on(w,y) | on(w,z) | same_per(x,w) | same_day(y,z). % Definition of consecutive days. % (negative clauses omitted because there is nothing for them % to resolve with) consec(Sun, Mon). consec(Mon, Tue). consec(Tue, Wed). consec(Wed, Thu). consec(Thu, Fri). consec(Fri, Sat). consec(Sat, Sun). % Definition of same_per and same_day. same_per(x,x). -same_per(a,b). -same_per(a,c). -same_per(b,c). same_day(x,x). -same_day(Sun, Mon). -same_day(Sun, Tue). -same_day(Sun, Wed). -same_day(Sun, Thu). -same_day(Sun, Fri). -same_day(Sun, Sat). -same_day(Mon, Tue). -same_day(Mon, Wed). -same_day(Mon, Thu). -same_day(Mon, Fri). -same_day(Mon, Sat). -same_day(Tue, Wed). -same_day(Tue, Thu). -same_day(Tue, Fri). -same_day(Tue, Sat). -same_day(Wed, Thu). -same_day(Wed, Fri). -same_day(Wed, Sat). -same_day(Thu, Fri). -same_day(Thu, Sat). -same_day(Fri, Sat). end_of_list. list(sos). -on(a, Sun). -on(a, Tue). -on(a, Thu). -on(b, Thu). -on(b, Sat). -on(c, Sun). end_of_list.