Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Princess Noura Bint Abdulrahman University College of Computer Science and Information Systems Computer Science Department Submission is online homework sent to the Homework #1 Name ……………………………………….. CS461: Artificial Intelligence Lab Homework #1 due date in Tuse,1April by a link not by email. Any email will be ignored. ID ……………………. Instructions: 1. Submit a printed copy of your answer with a print screen of your code & Questions screen. 2. Write your name, ID, class number and HM number in your answer. 3. Keep your answers secure. 4. Any cheats or copied answers will be counted -5. 5. Any late work will not be considered. Q1: Consider the following Prolog program: father(ahmad,sami). father(ahmad,khalid). father(sami,dana). father(sami,mohammed). father(khalid,reem). 1. 2. 3. 4. Define a Rule Define a Rule Define a Rule Define a Rule which holds iff X and Y are brothers. cousin(X,Y) which holds iff X and Y are cousins. grandson(X,Y) which holds iff X is a grandson of Y. descendent(X,Y) which holds iff X is a descendent of Y. brother(X,Y) 1) What Prolog answers to these questions (“True”, “False”, or variables bindings – write all possible bindings ). a. b. c. d. ????- brother(X,Y). cousin(dana,Y). grandson(X,reem). descendent(ahmad,reem). Q2: Which of the following are syntactically correct Prolog objects? What kind of objects are they? (atom , number , variable , structure) a. Diana b. diana c. 'Diana' d. _diana e. 'diana goes south' f. goes (diana,south) g. 45 h. 5(X,Y) i. +(north, west) j. three(black(cats)). Princess Noura Bint Abdulrahman University College of Computer Science and Information Systems Computer Science Department CS461: Artificial Intelligence Lab Homework #1 due date in Tuse,1April Q3: Will the following matching operation succeed or fail? If they succeed, what are the resulting instantiation of variables? a) point( A, B) = point( 1, 2) b) =(ann,'ann') c) point( A, B) = point( X, Y, Z) d) plus( 2, 2) = 4. e) +( 2, D) = +( E, 2). f) triangle( point(-1,0), P2, P3) = triangle( P1, point(1,0), point(0,Y) ) g) parent (adam, liz) = X. Q4: Consider the following program: f( 1, one). f( s(1), two). f( s(s(1)), three). f(s(s( s(s(s(X))))), N) :-f( X, N). How will Prolog answer the following questions? Whenever several answers are possible, give at least two. 1. 2. 3. 4. 5. 6. 7. ?- f( s(1), A). ?- f( s(s(1)), two). ?- f( s(s(s(s(s(s(1)))))), C). (explain your answer ) ?- f( D, three). ?- f(A,B). ?-f(s(X),1). ?- f(1,N).