Abstract individuals

next up previous
Next: Navigating through data structures (PEAI)
Up: Prolog versus English (PP)
Previous: English to Prolog
Back: to main list of student notes

Abstract individuals

You are now used to treating everyday objects like animals and people as individuals. A.I. researchers have found, when writing natural language processing programs, that they often need to do the same with more abstract things, such as acts, periods of time, and speeds. It's interesting to see how you can do this in Prolog.

For example, in Lesson 3, I justified Prolog by saying that it makes it easy to express sentences like ``Mary gave Fred a calculator''. You could write this as

    gives( mary, fred, calculator ).

But suppose we wanted to express the following:

On the day before Christmas, Mary eagerly gave a diamond-studded Faberge calculator to Fred for his Christmas present as they languidly downed foaming pints of nut-brown ale, basking in the luxuriantly sumptuous surroundings of Oxford's Welsh Pony hotel.

This sentence relates, via the act of giving, at least five pieces of data: a time, a giver, the given, the recipient, and the place. In addition, there are some other bits of information about the character of the act (eager), about what else was going on at the same time, and so on. In principle, you could write an enormous predicate with 10 or 20 arguments, allocating argument number 5 to be the place, 12 to be the character of the act, and so on. But this would get terribly unwieldy.

As another example, consider expressing ``Paul gave Elspeth a book'' and ``Robb gave Carole a book''. This is no problem:

    gave( paul, elspeth, book ).
    gave( robb, carole, book ).
But suppose we also want to say that Paul's gift to Elspeth was given before Robb's gift to Carole, and we also want to indicate that the two books were copies of the same work (but not the same individual). It is not possible to add such information to the above facts easily, and most A.I. programmers would not try. Instead, they would use a style of representation in which the acts of giving and the books are themselves named. Here is one way to do so.
    act( giving, g1 ).              act( giving, g2 ).
    actor( g1, paul ).              actor( g2, robb ).
    object( g1, b1 ).               object( g2, b2 ).
    recipient( g1, elspeth ).       recipient( g2, carole ).
    is_a( b1, book ).               is_a( b2, book ).
    title(b1,'Beer Atlas of Britain').
                                    title(b2,'Beer Atlas of Britain').
    printed( b1, 1991 ).            printed( b2, 1989 ).
    edition( b1, 9 ).               edition( b2, 5 ).
    before( g2, g1 ).
This means ``g1 is an act of giving; its actor is Paul; its object is b1 (a book); b1 is printed in 1991'' and so on.

Of course, Prolog doesn't care which style you use. There are a number of differing schemes, each with its pro- and opponents, but most resemble in some way the one above. Such schemes usually break down complex ideas into a large number of elementary predicates, in the way I broke down ``Paul gave the book to Elspeth'' into the predicates act, actor, object and recipient.

You will not be expected to use such schemes in the rest of this course, although if you want to do a project that involves generating them from English, we have some bits of program that can help. But it's interesting to see how they work out, and it will give you practice in reading Prolog programs. Below I have expressed a well-known limerick in this way. Can you work out what it means?

    slower( c, s ).
    is_a( s, speed ).
    follows( n, d2 ).
    velocity_of( light, c ).
    is_a( c, speed ).
    velocity_of( l1, s ).
    is_a( t, trip ).

next up previous
Next: Navigating through data structures (PEAI)
Up: Prolog versus English (PP)
Previous: English to Prolog
Back: to main list of student notes

Jocelyn Paine
Tue Jun 4 17:58:48 BST 1996