%
% CS 430 Prolog Assignment
% Spring 2015
%
% Name:
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Facts

% spouse(X,Y) is symmetric
spouse(mary,edward).
spouse(edward,mary).
spouse(mike,terry).
spouse(terry,mike).
spouse(gail,phil).
spouse(phil,gail).
spouse(ethel,tom).
spouse(tom,ethel).
spouse(john,ann).
spouse(ann,john).
spouse(edith,larry).
spouse(larry,edith).
spouse(jean,frank).
spouse(frank,jean).
spouse(tina,tim).
spouse(tim,tina).
spouse(andrea,molly).
spouse(molly,andrea).

male(bill).
male(edward).
male(john).
male(phil).
male(chuck).
male(tom).
male(mike).
male(barry).
male(carl).
male(dennis).
male(larry).
male(frank).
male(jack).
male(brian).
male(tim).
male(josh).
male(zach).
male(orem).
male(harry).
male(travis).

% Parents are biological parents
% parents(X,Y,Z) is read X has parents Y and Z.
parents(john,bill,mary).
parents(kelly,bill,mary).
parents(gail,mary,edward).
parents(ethel,mary,edward).
parents(mike,mary,edward).
parents(barry,john,ann).
parents(carl,john,ann).
parents(dennis,john,ann).
parents(edith,john,ann).
parents(jean,gail,phil).
parents(jack,gail,phil).
parents(brian,gail,phil).
parents(maggie,grace,chuck).
parents(tina,chuck,ethel).
parents(edna,mike,terry).
parents(molly,mike,terry).
parents(nina,edith,larry).
parents(orem,edith,larry).
parents(harry,jean,frank).
parents(tricia,tina,tim).
parents(travis,tina,tim).
parents(sarah,zach,molly).
parents(cathy,josh,edna).

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Rules

% TODO: your definitions should go here

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tests

test_female :-
    female(mary),
    female(edith),
    \+female(travis),
    female(zeus).

test_parent :-
    parent(tricia,tina),
    parent(tricia,tim),
    \+parent(tricia,chuck),
    \+parent(X,X),
    \+parent(mary,_).

test_father :-
    father(tricia,tim),
    \+father(tricia,tina),
    \+father(X,X),
    \+father(mary,_),
    \+father(_,mary).

test_mother :-
    mother(tricia,tina),
    \+mother(tricia,tim),
    \+mother(X,X),
    \+mother(mary,_),
    \+mother(_,edward).

test_step_father :-
    step_father(tina,tom),
    \+step_father(tina,chuck),
    \+step_father(X,X),
    \+step_father(_,andrea),
    \+step_father(ethel,_).

test_step_parent :-
    step_parent(kelly,edward),
    step_parent(sarah,andrea),
    \+step_parent(tina,grace),
    \+step_parent(X,X),
    \+step_parent(_,mary),
    \+step_parent(mary,_).

test_sibling :-
    sibling(tricia,travis),
    sibling(kelly,ethel),
    sibling(tina,maggie),
    \+sibling(harry,_),
    \+sibling(X,X).

test_sister :-
    sister(travis,tricia),
    sister(mike,kelly),
    \+sister(X,X),
    \+sister(harry,_),
    \+sister(tricia,travis).

test_aunt :-
    aunt(tina,kelly),
    aunt(tina,gail),
    aunt(cathy,andrea),
    \+aunt(X,X),
    \+aunt(sarah,andrea),
    \+aunt(_,john),
    \+aunt(mary,_).

test_grandparent :-
    grandparent(travis,ethel),
    grandparent(dennis,bill),
    \+grandparent(X,X),
    \+grandparent(tricia,tom),
    \+grandparent(ethel,_).

test_grandfather :-
    grandfather(tricia,chuck),
    grandfather(tina,edward),
    \+grandfather(X,X),
    \+grandfather(ethel,_),
    \+grandfather(_,mary).

test_ancestor :-
    ancestor(tricia,mary),
    ancestor(orem,bill),
    \+ancestor(tricia,bill),
    \+ancestor(X,X),
    \+ancestor(tom,_),
    \+ancestor(_,tom).

test_relative :-
    relative(ethel,tricia),
    relative(ethel,nina),
    relative(molly,harry),
    relative(mary,orem),
    \+relative(X,X),
    \+relative(tim,phil),
    \+relative(tom,_).

test_in_law :-
    in_law(tom,carl),
    in_law(andrea,harry),
    \+in_law(X,X),
    \+in_law(andrea,josh),
    \+in_law(mike,_).

test :- test_female, test_parent, test_father, test_mother, test_step_father,
        test_step_parent, test_sibling, test_sister, test_aunt, test_grandparent,
        test_grandfather, test_ancestor, test_relative, test_in_law, !.

