1% Computational Intelligence: a logical approach.
    2% CILOG Code. Example database from Section 3.3
    3% Copyright (c) 1998, Poole, Mackworth, Goebel and Oxford University Press
    4
    5% course(C) is true if C is a university course
    6course(312).
    7course(322).
    8course(315).
    9course(371).
   10
   11% department(C,D) is true if course C is offered in department D.
   12department(312,comp_science).
   13department(322,comp_science).
   14department(315,math).
   15department(371,physics).
   16
   17% student(S) is true if S is a student
   18student(mary).
   19student(jane).
   20student(john).
   21student(harold).
   22
   23% female(P) is true if person P is female
   24female(mary).
   25female(jane).
   26
   27% enrolled(S,C) is true if student S is enrolled in course C
   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
   55% EXAMPLE QUERIES
   56% ask enrolled(S,C) & department(C,D).
   57% ask cs_course(C).
   58% ask cs_or_math_course(C).
   59% ask in_dept(S,D).