Q0 Set up : svn export http://unbox.org/wisp/var/timm/10/310/src/prolog/4/a : svn add a : svn commit -m "4a ready to go" : For each of the following questions, add lines like this to "run" printf "\n===== 4/a/q1 ========================\n\n" cat myCodeThatAnswersThisQuestion.pl execute : where "execute" is the "test" command shown below. Background stuff Manual : For a Prolog manual, see http://www.swi-prolog.org/pldoc/refman/ Beware upper case :When in doubt, make it lower case Only for variables, make them upper case File structure Same as before. : Files are load alphabetically. First thing loaded : "aBagOfTricks.pl" : contains tim tricks Last thing loaded : "z.pl" : contains "main" which, right now, does not much and calls halt. : All your homeworks will modify "main" in "z.pl" The family database is in two forms: 1) standard; 2) frame standard prolog : see family.pl which holds gender/2, father/2, mother/2. e.g. : gender(anne,female). : father(anne,boris). : mother(anne,betty). querying standard databases : parent(X,Y) :- father(X,Y). : parent(X,Y) :- mother(X,Y). : grandfather(X,Y) :- parent(X,Z),father(Z,Y). frame format : see frames.pl : contains a macro for fast specification of object-attribute-value facts (oav). e.g : you write 'anne has [gender=female, father=boris, mother=betty]' : prolog turns this into : oav(anne,gender,female) : oav(anne,father,boris). : oav(anne,mother,betty). querying aov triples : parental(X,Y) :- father of X = Y. : parental(X,Y) :- mother of X = Y. : grandfatheral(X,Y) :- parental(X,Z),father of Z = Y.0 Q1 Write sister/2 using the standard format Hints: : a sister is a female sibling : sibling(X,Y) :- parent(X,Z), parent(Y,Z). Test: : modify z.pl. complete the "sibling" code : then bash run Q2 Write aunt/2 using the standard format Hints: : an aunt is a sister of your mother (so try to reuse your Q1 answer) Test : write an "aunts" and an "aunt" predicate in z.pl : then bash run Q3 Write sisteral/2 using the frame format Hints: : see lnes 34.. 37 of frames.pl Test: : modify z.pl. add "sisterals" and "siteral" : then bash run Q4 Write auntal/2 using the frame format Test : write an "auntals" and an "auntal" predicate in z.pl : then bash run Q5 Port the scifi story into the format of english.pl : everything lower case : terminals in square brackets : don't forget the full stops "."!!! : conjunctions seperated by commas : disjunctions are two rules with the same head : see "modlist" for how to handel zero or more. Test : sentence1 :- sentence(X,[]),print(X),nl. (do not wrap this in a sentences... it will print out every sentence!)