I'm trying to work on a homework assignment based on the old song, I'm my own grandpa.
So, I've started out defining rules for who a son, daughter, father, father_in
_law, etc was.
However, something must be wrong with the order of my rules/facts because every time I load it I get the following errors:
GNU Prolog 1.3.1
By Daniel Diaz Copyright (C) 1999-2009
Daniel Diaz | ?- [grandpa]. compiling /home/nfs/student/USER/cs4700/grandpa.pl
for byte code...
/home/nfs/student/USER/cs4700/grandpa.pl:119: warning: discontiguous predicate child/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:120: warning: discontiguous predicate child/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:121: warning: discontiguous predicate child/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:122: warning: discontiguous predicate child/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:123: warning: discontiguous predicate child/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:124: warning: discontiguous predicate child/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:125: warning: discontiguous predicate son/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:126: warning: discontiguous predicate son/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:127: warning: discontiguous predicate son/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:128: warning: discontiguous predicate son/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:129: warning: discontiguous predicate son/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:130: warning: discontiguous predicate daughter/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:131: warning: discontiguous predicate married/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:132: warning: discontiguous predicate married/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:133: warning: discontiguous predicate married/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:134: warning: discontiguous predicate married/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:135: warning: discontiguous predicate son_in_law/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:136: warning: discontiguous predicate father_in_law/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:137: warning: discontiguous predicate father/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:138: warning: discontiguous predicate father/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:139: warning: discontiguous predicate father/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:140: warning: discontiguous predicate mother/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:141: warning: discontiguous predicate mother/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:142: warning: discontiguous predicate mother/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:143: warning: discontiguous predicate step_mother/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:144: warning: discontiguous predicate brother_in_law/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:145: warning: discontiguous predicate brother_in_law/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:146: warning: discontiguous predicate uncle/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl:147: warning: discontiguous predicate step_daughter/2 - clause ignored
/home/nfs/student/USER/cs4700/grandpa.pl compiled, 149 lines read - 8389 bytes written, 44 ms
And my code so far is:
child(X,Y):-
son(Y,X).
child(X,Y):-
daughter(Y,X).
parent(X,Y):-
father(X,Y).
parent(X,Y):-
mother(X,Y).
son(X,Y):-
child(X,Y),
male(X).
daughter(X,Y):-
child(X,Y),
female(X).
son_in_law(X,Y):-
child(X,Z),
not(child(X,Y)),
married(Z,Y),
male(X).
step_daughter(X,Y):-
child(X,Z),
married(Z,Y),
not(child(X,Y)),
female(X).
brother(X,Y):-
sibling(X,Y),
male(X).
brother_in_law(X,Y):-
parent(Z,X),
parent(Z,Y),
not(sibling(X,Y)),
male(X).
sibling(X,Y):-
parent(Z,X),
parent(Z,Y).
sister(X,Y):-
sibling(X,Y),
female(X).
father(X,Y):-
parent(X,Y),
male(X).
father_in_law(X,Y):-
child(X,Z),
married(Y,Z),
not(child(X,Y)),
male(X).
mother(X,Y):-
parent(X,Y),
female(X).
step_parent(X,Y):-
married(X,Z),
parent(Z,Y),
not(parent(X,Y)).
step_father(X,Y):-
step_parent(X,Y),
male(X).
step_mother(X,Y):-
step_parent(X,Y),
female(X).
grandparent(X,Y):-
parent(X,Z),
parent(Z,Y).
grandmother(X,Y):-
grandparent(X,Y),
female(X).
grandfather(X,Y):-
grandparent(X,Y),
male(X).
grandchild(X,Y):-
child(X,Z),
child(Z,Y).
married(X,Y):-
wife(X,Y),
female(X).
married(X,Y):-
husband(X,Y),
male(X).
uncle(X,Y):-
sibling(X,Z),
parent(Z,Y),
male(X).
aunt(X,Y):-
sibling(X,Z),
parent(Z,Y),
female(X).
male(i).
male(f).
male(s1).
male(s2).
female(w).
female(d).
child(i,f).
child(s1,w).
child(s1,i).
child(s2,d).
child(s2,f).
child(d,w).
son(i,f).
son(s1,w).
son(s1,i).
son(s2,d).
son(s2,f).
daughter(d,w).
married(i,w).
married(w,i).
married(f,d).
married(d,f).
son_in_law(f,i).
father_in_law(i,f).
father(f,i).
father(i,s1).
father(f,s2).
mother(w,s1).
mother(w,d).
mother(d,s2).
step_mother(d,i).
brother_in_law(f,s1).
brother_in_law(s1,f).
uncle(s1,i).
step_daughter(d,i).
I'm very new to prolog so I'm probably just making some fundamental mistake. Can someone help point me in the right direction concerning these errors?