; This small program contains a small database of family relationships
; and some rules defining the predicates 'parent', sibling', 'sister' etc
; You can explore the program by such queries as ? uncle (X,Y).
; Try also to add rules for new predicates like 'aunt', 'cousin', 'niece',
; 'grandfather'.
; Simple programs like these often contain redundant (i.e. double) solutions,
; e.g. brother (peter, mary) is found twice because peter and mary 
; share two parents

;************************** FACTS ***********************************

father (john, mary).     mother (susan, mary).    ; mary's parents
father (john, peter).    mother (susan, peter).
father (john, eve).      mother (sharon, eve).
father (alex, nelly).    mother (sharon, nelly).
father (peter, carl).    mother (nelly, carl).
father (martin, jacob).  mother (eve, jacob).
father (bert, sandra).   mother (mary, sandra).
male (carl).             female (sandra).
male (jacob).

;************************ RULES **************************************

male (X) <- father (X, Y).          ; fathers are male,...
female (X) <- mother (X, Y).        ; ... and mothers female 
parent (X, Y) <- mother (X, Y).     ; mothers are parents,..
parent (X, Y) <- father (X, Y).     ; .. fathers too
sibling (X, Y) <-          ; sibling means "brother-or-sister" 
     parent (Z, X),        
     parent (Z, Y),
     X \= Y.
sister (X, Y)  <- female (X), sibling (X, Y).
brother (X, Y) <- male (X), sibling (X, Y).
uncle (X, Y) <- brother (X, Z), parent (Z, Y).
