- bread = bread
- ’Bread’ = bread
- ’bread’ = bread
- Bread = bread
- bread = sausage
- food(bread) = bread
- food(bread) = X
- food(X) = food(bread)
- food(bread,X) = food(Y,sausage)
- food(bread,X,beer) = food(Y,sausage,X)
- food(bread,X,beer) = food(Y,kahuna_burger)
- food(X) = X
- meal(food(bread),drink(beer)) = meal(X,Y)
- meal(food(bread),X) = meal(X,drink(beer))
Which of the following queries are satisfied? Where relevant, give all the variable instantiations that lead to success.
- ?- magic(house_elf).
- ?- wizard(harry).
- ?- magic(wizard).
- ?- magic(’McGonagall’).
- ?- magic(Hermione).
Draw the search tree for the query magic(Hermione) .
Exercise 2.3 Here is a tiny lexicon (that is, information about individual words) and a mini grammar consisting of one syntactic rule (which defines a sentence to be an entity consisting of five words in the following order: a determiner, a noun, a verb, a determiner, a noun).
word(noun,’big kahuna burger’).
What query do you have to pose in order to find out which sentences the grammar can generate? List all sentences that this grammar can generate in the order that Prolog will generate them in.
astante , astoria , baratto , cobalto , pistola , statale .
They are to be arranged, crossword puzzle fashion, in the following grid:
The following knowledge base represents a lexicon containing these words:
Write a predicate crossword/6 that tells us how to fill in the grid. The first three arguments should be the vertical words from left to right, and the last three arguments the horizontal words from top to bottom.