4
6course(312).
7course(322).
8course(315).
9course(371).
10
12department(312,comp_science).
13department(322,comp_science).
14department(315,math).
15department(371,physics).
16
18student(mary).
19student(jane).
20student(john).
21student(harold).
22
24female(mary).
25female(jane).
26
28enrolled(mary,322).
29enrolled(mary,312).
30enrolled(john,322).
31enrolled(john,315).
32enrolled(harold,322).
33enrolled(mary,315).
34enrolled(jane,312).
35enrolled(jane,322).
36
37% cs_course(C) is true if course C is offered in
38% the computer science department
39cs_course(C) <- department(C,comp_science).
40
41% math_course(C) is true if course C is offered in
42% the mathematics department
43math_course(C) <- department(C,math).
44
45% cs_or_math_course(C) is true if course C is offered in
46% either the computer science department or the
47% mathematics department
48cs_or_math_course(C) <- cs_course(C).
49cs_or_math_course(C) <- math_course(C).
50
51% in_dept(S,D) is true if student S is enrolled
52% in a course offered in deparment D
53in_dept(S,D) <- enrolled(S,C) & department(C,D).
54