family([mom,dad],[[daughter1, daughter2],[son1,son2,son3]]).
One shortcoming of this list representation is that it doesn't represent the chronological order of all the children. You can tell who is the oldest son and who is the oldest daughter but not who is the oldest child.
So we now want to rewrite our database using the following representation scheme:
family([mom,dad],[[child1,female],[child2,male],[child3,male]]).
Using the proposed scheme to represent the family database, write PROLOG definitions for each of the following predicates.
parent_of(Parent,Child) father_of(Father,Child) mother_of(Mother,Child) ancestor_of(Ancestor,Descendant) %% Should be recursive sibling_of(Sib1,Sib2) sister_of(Sister, Sibling) brother_of(Brother,Sibling) oldest_child (Parent,Oldest) oldest_son (Parent,OldestSon) oldest_daughter(Parent,OldestDaughter) number_of_children(Parent,Num) %% Should use the 'is' predicate number_of_sons(Parent,N). number_of_daughters(Parent,N).USEFUL PREDICATES: Here is a collection of useful PROLOG files containing some predicates that may be helpful for this assignment: CPSC 352 Prolog Stuff. There are several PROLOG sample programs available there as well. Feel free to have a look there and borrow whatever is helpful.
HANDIN DIRECTIONS:
To make a copy of your PROLOG sessions, you use the Unix script command:
$ script sfilename // a copy of your session will be saved bash$ prolog // script changes the unix prompt ?- // Do your PROLOG thing. ?- ... ?- ^D // exit PROLOG bash$ ^D // control-D exits from script Script done. File is sfilename. $lpr sfilename // print your script and annotate it