1% The knowledge of the teacher about different topics
    2
    3% Fact theory
    4
    5db_entry(teacher:gilchrist_family,parent(euan,warren),[]).
    6db_entry(teacher:gilchrist_family,parent(berenice,warren),[]).
    7db_entry(teacher:gilchrist_family,parent(warren,catherine),[]).
    8db_entry(teacher:gilchrist_family,parent(warren,charles),[]).
    9db_entry(teacher:gilchrist_family,parent(warren,david),[]).
   10db_entry(teacher:gilchrist_family,parent(warren,julia),[]).
   11db_entry(teacher:gilchrist_family,parent(kate,catherine),[]).
   12db_entry(teacher:gilchrist_family,parent(kate,charles),[]).
   13db_entry(teacher:gilchrist_family,parent(kate,david),[]).
   14db_entry(teacher:gilchrist_family,parent(kate,julia),[]).
   15db_entry(teacher:gilchrist_family,parent(charles,lucinda),[]).
   16
   17% Fact and Rule Theory
   18
   19def_theory(teacher:entropy, [teacher:warm,teacher:cold,teacher:door]).
   20db_entry(teacher:warm, warm(kitchen),[]).
   21db_entry(teacher:warm, warm(living_room),[]).
   22db_entry(teacher:cold, cold(fridge),[]).
   23db_entry(teacher:cold, cold(street),[]).
   24db_entry(teacher:cold, cold(garden),[]).
   25db_entry(teacher:door, door(living_room,kitchen),[]).
   26db_entry(teacher:door, door(living_room,street),[]).
   27db_entry(teacher:door, door(living_room,garden),[]).
   28db_entry(teacher:door, door(kitchen,garden),[]).
   29db_entry(teacher:door, door(kitchen,fridge),[]).
   30db_entry(teacher:door, door(street,garden),[]).
   31db_entry(teacher:entropy, entropy_increases(A,B),[warm(A),cold(B),door(A,B)]).
   32db_entry(teacher:entropy, entropy_increases(A,B),[cold(A),warm(B),door(A,B)]).
   33db_entry(teacher:entropy, entropy_increases(A,B),[warm(A),cold(B),door(B,A)]).
   34db_entry(teacher:entropy, entropy_increases(A,B),[cold(A),warm(B),door(B,A)]).
   35
   36% Recusive Theory
   37
   38db_entry(teacher:t_member, member(A,[A|_]),[]).
   39db_entry(teacher:t_member, member(A,[_|B]),[member(A,B)]).
   40
   41db_entry(teacher:t_append, append([],List,List),[]).
   42db_entry(teacher:t_append, append([First|Rest],List,[First|TempList]),
   43			   [append(Rest,List,TempList)]).
   44
   45def_theory(teacher:t_reverse,[teacher:t_append]).
   46db_entry(teacher:t_reverse,reverse([],[]),[]).
   47db_entry(teacher:t_reverse,reverse([X|Y],Z),
   48			   [reverse(Y,Y1),append(Y1,[X],Z)]).
   49
   50def_theory(teacher:qsort,[teacher:partition,teacher:t_append]).
   51db_entry(teacher:qsort,qsort([],[]),[]).
   52db_entry(teacher:qsort,qsort([X|L],L5),
   53		       [partition(L,X,L1,L2),qsort(L1,L3),
   54			qsort(L2,L4),append(L3,[X|L4],L5)]).
   55
   56db_entry(teacher:partition,partition([],_,[],[]),[]).
   57db_entry(teacher:partition,partition([X|L],Y,[X|L1],L2),
   58			   [X < Y, partition(L,Y,L1,L2)]).
   59db_entry(teacher:partition,partition([X|L],Y,L1,[X|L2]),
   60			   [X >= Y, partition(L,Y,L1,L2)])