hw-assign1 - What are the heads of the rules, and what are...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
King AbdulAziz University CPCS-331 Faculty of Computing & Information Technology Prolog-Lab Fall Semester – 2011 Lecturer: I. Aasma Memon Homework Assignment # 1 Due Date: 12 th Nov’ 2011 Q1. Which of the following sequences of characters are atoms, which are variables, and which are neither?[2 marks] 1. vINCENT 2. Footmassage 3. variable23 4. Variable2000 5. big_burger 6. big burger 7. 'Jules' 8. '_Jules' Q2. Which of the following sequences of characters are atoms, which are variables, which are complex terms, and which are not terms at all? Give the functor and arity of each complex term.[3 marks] 1. loves(Vincent,mia). 2. 'loves(Vincent,mia)'. 3. Butch(boxer). 4. boxer(Butch). 5. (Butch kills Vincent). 6. kills(Butch,Vincent. Q3. How many facts, rules, clauses, and predicates are there in the following knowledge base?
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: What are the heads of the rules, and what are the goals they contain?.[3 marks] woman(vincent). woman(mia). man(jules). person(X) :- man(X); woman(X). loves(X,Y) :- knows(Y,X). father(Y,Z) :- man(Y), son(Z,Y). father(Y,Z) :- man(Y), daughter(Z,Y). Q4. Translate the following statements in to prolog rules: [1 mark] Everybody who has a child is happy (introduce a one-argument relation ishappy . Q5. Define the relation grandchild using the parent relation.[1 mark] Hint: It wilt be Similar to the grandparent relation Q6. Define the relation aunt( X, Y) in terms of the relations parent and sister.[3 marks] Q7.For all X, if X has a child who has a sister, then X has Two Children .[2 marks] (introduce a new relation hasTwoCHildren)...
View Full Document

This note was uploaded on 01/02/2012 for the course COMPUTER 101 taught by Professor Dr.kahan during the Spring '11 term at Akademia Ekonomiczna w Krakowie.

Ask a homework question - tutors are online