
/* female(X)  defines which individuals (atoms), X, are female  */
female(marge).
female(lisa).
female(maggie).

/* hasParents(X, F, M)  defines that individual  X  has  F  as a father 
     and  M  as a mother  */
hasParents(bart, homer, marge).
hasParents(lisa, homer, marge).
hasParents(maggie, homer, marge).

/* isSisterOf(X, Y)  defines that  X  is the sister of  Y  if
   X is female,  X's and Y's parents are the same, and  X != Y  */
isSisterOf(X,Y) :- female(X),
                   hasParents(X,F,M), hasParents(Y,F,M), X \= Y.

/* what do these define?    (Note:  _  means "don't care")   */
isMotherOf(M, X) :- hasParents(X, _, M).
isDaughterOf(D, P) :- female(D), hasParents(D,P,_).
isDaughterOf(D, P) :- female(D), hasParents(D,_,P).


/* What happens if we type a period instead of a comma in the above ?  */

/* Some useful built-in predicates:   listing,  write(E),  trace(PREDICATE)
   Try each of them.  */

/* An _atom_ is a single word,  e.g.,  homer ,  or a single-quoted
   string, e.g.,  'Homer Simpson'.

   A logical variable must begin with an Uppercase letter.

   A _string_ is double quoted, e.g.,  "Homerun", and it is actually
   a list of ints (ASCII codes) !   For now, use just atoms.
*/


