Technology

Technology

  • Submitted By: rqnnie
  • Date Submitted: 11/08/2010 2:26 PM
  • Category: Science
  • Words: 541
  • Page: 3
  • Views: 181

EXERCISE 1 – DAY Question 1 office(ernest, level3). offices(‘CIT’, level4). Evaluate ?- office(ernest, Level4). ?- offices(cit, level4). ?- office(Ernest, level3). ?- offices(CIT, level4). Question 2 Give the answer to the query '?- bird(B)' in the order in which it occurs considering recursion and backtracking. animal(percy). has_feathers(percy). penguin(tweety). penguin(peter). tame(peter). bird(X) :penguin(X). bird(X) :animal(X), has_feathers(X). tame_bird(X) :bird(X), tame(X). Question 3 Which of the following match and what are the resultant bindings? 1. anxghy(X, Y) = anxghy(1, X). 2. book(title(Name), author(Author)) = book(title(lord_of_the_rings), author(tolkien)). 3. X+Y-Z = 1+5-1, Z = X.

EXERCISE 1 – DAY - ANSWERS Question 1 office(ernest, level3). offices(‘CIT’, level4). Evaluate ?- office(ernest, Level4). ?- offices(cit, level4). ?- office(Ernest, level3). ?- offices(CIT, level4). Question 2 Give the answer to the query '?- bird(B)' in the order in which it occurs considering recursion and backtracking. animal(percy). has_feathers(percy). penguin(tweety). penguin(peter). tame(peter). bird(X) :penguin(X). bird(X) :animal(X), has_feathers(X). tame_bird(X) :bird(X), tame(X). Question 3 Which of the following match and what are the resultant bindings? 1. anxghy(X, Y) = anxghy(1, X). X = 1, Y = 1 2. book(title(Name), author(Author)) = book(title(lord_of_the_rings), author(tolkien)). Name = lord_of_the_rings Author = tolkien 3. X+Y-Z = 1+5-1, Z = X. X = 1, Y = 5, Z = 1. ?- bird(B) B = tweety ; B = peter; B = percy; false. Level4 = level3 false Ernest = ernest CIT = ‘CIT’

EXERCISE 1 – EVE

Question 1 car(type(toyota), name(prado)). car(type(mitsubishi), name(galant)). car(type(toyota), name('Mark-X')). Evaluate : ?- car(type(toyota), name(Prado)). ?- car(type, Name). ?- car(type(toyota), name(Mark-X)). ?- car(type(mitsubishi), name(Galant)). Question 2 ancestor(Person, Ancestor) :- parent(Person, Ancestor). ancestor(Person, Ancestor) :-...

Similar Essays