UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

An approach to the organization of knowledge for the modelling of conversation McCalla, Gordon Irvine 1977

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Notice for Google Chrome users:
If you are having trouble viewing or searching the PDF with Google Chrome, please download it here instead.

Item Metadata

Download

Media
831-UBC_1977_A1 M32.pdf [ 14.97MB ]
Metadata
JSON: 831-1.0051793.json
JSON-LD: 831-1.0051793-ld.json
RDF/XML (Pretty): 831-1.0051793-rdf.xml
RDF/JSON: 831-1.0051793-rdf.json
Turtle: 831-1.0051793-turtle.txt
N-Triples: 831-1.0051793-rdf-ntriples.txt
Original Record: 831-1.0051793-source.json
Full Text
831-1.0051793-fulltext.txt
Citation
831-1.0051793.ris

Full Text

AN APPROACH TO THE ORGANIZATION OF KNOWLEDGE FOR THE MODELLING OF CONVERSATION by GORDON IRVINE MCCALLA B.Sc, Oniversity of Alberta, 1968 M.Sc, University of Alberta, 1970 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSOPHY xn THE FACULTY OF GRADUATE STUDIES DEPARTMENT OF COMPUTER SCIENCE He accept t h i s thesis as conforming to the reguired standard THE UNIVERSITY OF BRITISH COLUMBIA June, 1977 {c) Gordon McCalia, 1977 In presenting th i s thes is in pa r t i a l fu l f i lment of the requirements for an advanced degree at the Univers i ty of B r i t i s h Columbia, I agree that the L ibrary sha l l make it f ree ly ava i l ab le for reference and study. I fur ther agree that permission for extensive copying of th i s thesis for scho lar ly purposes may be granted by the Head of my Department or by his representat ives. It is understood that copying or p u b li c a ti o n of th is thes is for f inanc ia l gain sha l l not be allowed without my writ ten permission. Department of The Univers i ty of B r i t i s h Columbia 2075 Wesbrook Place Vancouver, Canada V6T 1W5 Date CfttA)£ iS, ^11 i A B S T R A C T Presented i s a description of an approach to the modelling of conversation. I t i s suggested that to have any hope of succeeding at t h i s endeavour, the problem must be tackled p r i n c i p a l l y as a problem i n pragmatics rather than as one i n language analysis alone. Several pragmatic aspects of conversation are delineated and i t i s shown that the attempt to account for them ra i s e s a number of general issues i n the representation of knowledge. A scheme for resolving some of these issues i s constructed and given computational description as a set of (non-implemented) LISP-based control structures c a l l e d JLISP. Central to t h i s scheme are several d i f f e r e n t types of object that encode knowledge and communicate this knowledge by passing messages. One p a r t i c u l a r kind of object, the pattern expression UPEXPB), turns out to be the most v e r s a t i l e . IPEXPBs can encode an arbitrary amount of procedural or declarative information; are capable, as a by-product of t h e i r message passing behaviour of providing both a context for future processing decisions and a record of past processing decisions; and make contributions to the resolution of several a r t i f i c i a l i n t e l l i g e n c e problems. A model of conversation i s then proposed and some examples of t y p i c a l conversations that might occur i n the general context of attending a symphony concert are detailed in JLISP. It i s suggested that conversation i s goal oriented behaviour; and, in f a c t , the model i s presented in terms of l e v e l of goal: from higher l e v e l non-linguistic goals through s c r i p t s d i r e c t i n g both sides of a conversation, speech acts guiding one conversant's actions, and, f i n a l l y , language l e v e l goals providing a basic parsing component for the model. In addition, a place i s delineated for b e l i e f models of the conversants, necessary i f utterances are to be properly understood or produced. The embedding of t h i s kind of language model in a JLISP base y i e l d s a r i c h pragmatic environment for analyzing conversation. i i TABLE OF CONTENTS CHAPTER I: Introduction . 1 1.1 Background: Some Trends • 2 1.2 Issues and Limitations ............................... 7 1.3 What's Proposed? 11 1.3.1 Concepts of Representation 11 1.3.2 Concepts of Language ...........................13 1.4 Organization of the Thesis . 1 5 CHAPTER I I : analyzing Conversation 17 2.1 B ackground ................................. . . ....... 19 2.2 Issues 23 2.3. Levels of Analysis ..28 2.4 Where to Begin ...................................... 34 CHAPTER I I I : A Scheme for Representing Knowledge ............ 36 3.1 Br i e f Overview 37 3.2 The Objects 43 3.2.1 Pattern Expressions 43 3.2.2 Other Objects .. 44 3.3 Details of Message Passing .......................... 45 3.3.1 Introduction 45 3.3.2 Messages to |PEXPRs ..,,.,,,,.,.,.,...,,,,.,....>. 48 3.4 The Matcher ............................................ 54 3.4.1 The Defin i t i o n of the Pattern Matching Macros .. 54 3.4.2 D i f f i c u l t i e s with Macros ....................... 63 3.5 Pointers and Searching 66 3.6 Interrupts .72 3.7 Simulated Parallelism ............................... 76 CHAPTER IV: An Evaluation of the Representation Scheme ...... 78 4.1 The PLANNER / CONNIVES Approach .................. 78 4.1.1 The Data Base ................... ... ....79 4.1.2 Pattern Matching ... .... 80 4.1.3 Procedures .....................................81 4.1.4 Control 83 4.2 Frames - 86 4.2.1 Why are Frames Needed? .........................87 4.2.2 What do Frames Look Like? ............. ,..,.,.,...90 4.2.3 Inter-frame Connections 97 4.3 Other Approaches ................................... 106 4.4 Contributions to the Issues ........................ 108 ^HAPTEB V: Modelling Conversation: A Detailed Example 115 5.1 The Concert Scenario .....,......,...,,,...,..,.,,.,118 5.2 Overview of the Model 125 5 .3 Non-linguistic Goals 135 5.3.1 The Highest Goals ............................. 135 5.3.2 A Major Subgoal: ATTEND-CONCERT 138 i i i 5.3.3 The BUY Subgoal .................. ......... 146 5.4 Scripts ......... .................150 5.4.1 BUY-CONVERSATION ..............................150 5.4.2 WHAT-DO-YOU-WANT ,. ................ 155 5.4.3 BARGAIN 157 5.4.4 EXCHANGE 165 5.4.5 FAREWELL ...................................... 166 5.5 Speech Acts ............................168 5.5.1 INQUIRE ............. 169 5.5.2 The Associative Activation of YES2 171 5.5.3 IES2 .......................................... 174 5.6 The Language Level 177 5.6.1 Interpreting UTTERANCES and CLAUSES ........... 181 5.6.2 Interpreting NOUNGs, VERBGs, and PREPGs 185 5.6.3 Generation 189 5.7 Conversations II and III ........................... 190 CHAPTER VI: Generalizations and Extensions ................. 199 6.1 Representation Properties of the Model 199 6.1.1 The ISA Hierarchy 199 6.1.2 The PART-OF Hierarchy 204 6.1.3 The Execution Environment 205 6.1.4 One-Shot Relations ............................ 210 6.1.5 Procedural Knowledge .,,.,..,,...,.......,....,210 6.2 L i n g u i s t i c A b i l i t i e s of the Model 213 6.2.1 Scripts .................. 214 6.2.2 Speech Acts 216 6.2.3 The Language Level .218 6.3 Possible Extensions ................................ 222 6.3.1 Meta Patterns 222 6.3.2 Garbage Co l l e c t i o n and Learning ............... 225 6.3.3 Non-Goal Directed Processing .................. 228 6.3.4 Comparing IPEXPRs 231 6.3.5 Miscellaneous Extensions ...................... 236 CHAPTER VII: Conclusion ........... 238 7.1 Contributions to Representation .................... 238 7.2 Contributions to Language Analysis 243 7.3 Future Directions 247 BIBLIOGRAPHY 249 APPENDIX I: Some System Objects .....256 a 1.1 Basic Interpreter Objects 257 A1.2 Redefined LISP SOBRs ................. 263 A 1.3 Objects Which Create Objects 265 A1.4 Objects for Communicating with Objects 266 A1.5 Objects Involved in Matching 268 A1.6 Objects Which Manipulate Patterns ..,,,......,....,271 A1.7 Objects for Searching 273 A1.8 Objects Involved in Saving Stacks 275 &1.9 Special Purpose Objects .,,,...278 APPENDIX II: Concert Scenario JPEXPRs 281 iv A2.1 Conversation I ..................................., 281 &2.2 Conversations II and III 290 INDEX 294 V LIST OP FIGURES HiSMEg 3.J. - Macro C o n f l i c t Table............................. 65 EJ-.g^gg 3.2 - A Small Network.................................. 68 £iau£e 3.3 - INSTANCE-OF Link.................................68 Figure 4._1 - SUPERSET P o i n t e r s . 1 0 1 Figure 5.1. - The Dynamic Linkages of Some Concert Scenario |PEXPRs........................ 127 Figure 5.2 - Order of Presentation................ ......135 Figure 5.3 - Network for Concert Information 140 Figure 5.4 - Ticket Information.. ....145 Figure 5.5 - Goal Tree for the Ticket Buying Conversation. 152 Figure 5.6 - Speech Acts i n the Model........................ 178 Figure 5 . 7 - Word Group Hierarchy............................ 180 Figure 5.8 - People.......................................... 192 Figure 5.9 - Bargaining Positions............................194 Figure 6.V - An Episode i n Memory............................ 209 v i ACKNOWLEDGEMENTS Many of the ideas developed here have arisen or have been more sharply focussed as a resu l t of the comments and c r i t i c i s m s of others. I would p a r t i c u l a r l y l i k e to thank my supervisor, fiichard Rosenberg, who has lent his ear to my harangues and complaints and who has guided me through the long and painful evolution of t h i s research. The other members of the committee, Alan Mackworth, Ray Reiter, Bary Pollack, and Bernie Mohan have also been of great help i n various discussions and i n their comments on e a r l i e r thesis d r a f t s . In many stimulating coffee break conversations, and elsewhere, my fellow graduate students at UBC, especially Rachel Gelbart, B i l l Havens, Peter Rowat, Michael Kuttner, Brian runt, and Jim Davidson, have been both useful c r i t i c s and sources of ideas. In addition, the unflagging enthusiasm of the Snarfler, L. R. Floyd, must be acknowledged. Because the thesis was fin i s h e d while I was teaching at the University of Toronto, a not i n s i g n i f i c a n t contribution has been provided by my colleagues and friends there. For many a l l night discussions that provided several i n s i g h t s , my thanks to Hector Levesgue and to Pat Levesgue for putting up with us. My appreciation also to John Mylopoulos, Ray Perrault, P h i l Cohen, Lou M e l l i , Dick Peacocke, and Nick Roussopoulos. F i n a l l y , I would l i k e to acknowledge Sydney J . Hurtubise who said i t a l l a long time ago. CHAPTER I Introduction This thesis i s concerned with the computational modelling of natural language conversation. A prereguisite to the study of conversation has turned out to be representation: how i s i t possible to organize the vast amount of world and l i n g u i s t i c knowledge that i s reguired i n such an undertaking? A method of organization has been devised that allows much of t h i s knowledge to be encoded reasonably conveniently i n modules c a l l e d objects. One p a r t i c u l a r type of object, the pattern expression, turns out t o be extremely useful, and i t , e s p e c i a l l y , i s examined with regard to how i t encodes and communicates i t s information. The organization in general, and the pattern expression i n p a r t i c u l a r , i s shown " i n action" handling three conversations which might occur i n the scenario of attending a symphony concert. The following aspects of language and representation have been at least touched upon i n the t h e s i s : the handling of two task-oriented and one non-task-oriented dialogue; a re-categorization of l i n g u i s t i c knowledge that tends to meld such t r a d i t i o n a l d i s t i n c t i o n s as those dividing syntax, semantics, and pragmatics, and also the d i v i s i o n between l i n g u i s t i c and non-linguistic knowledge; a characterization of how to combine knowledge from a s c r i p t , knowledge about intention and purpose, knowledge about the conversants, and Chapter I 2 l i n g u i s t i c knowledge; the necessity for explaining or excusing errors; the need for a context mechanism; and the usefulness of expectation in guiding the processing of natural language. Although a l l these issues are encountered, none of them i s , of course, resolved completely; in some cases only the very beginnings of a solution are outlined. The approach here i s not as concerned with finding detailed solutions to particular problems as i t i s with trying to accomodate a wide variety of phenomena, perhaps at the expense of depth i n places. This seemed a necessary price to pay i n order to look at the problem i n some generality. I « l Background: Some Trends The approach taken here i s based on three trends which I perceive i n the study of language. The f i r s t trend i s the ever broadening focus of attention of l i n g u i s t i c s . After Bloomfield {1933} l i n g u i s t s f e l t constrained to focus th e i r attention on a r e l a t i v e l y narrow subset of l i n g u i s t i c phenomena, with most attention being paid to phonetics and syntax. The Chomskian revolution (see Chomsky (1957) for the opening shots) brought an impressive new descriptive power to l i n g u i s t i c s which enabled many things to be explained which up u n t i l then had remained a mystery. Of pa r t i c u l a r importance were the notions of " i n f i n i t e capacity with f i n i t e means" (i.e. generating an i n f i n i t e number of sentences using phrase structure rules and transformations) whereas previous corpus-based analyses had Chapter I 3 seemed to be attempting the im p o s s i b l e task of c o l l e c t i n g a l l v a l i d sentences; the competence / performance d i s t i n c t i o n , a l l o w i n g knowledge about language i t s e l f t o be separated from the v a g a r i e s of people's a c t u a l use of language; and the d i s c o v e r y of the u n d e r l y i n g deep s t r u c t u r e s i m i l a r i t y of many seemingly d i f f e r e n t s u r f a c e d e s c r i p t i o n s . In the m i d - s i x t i e s the Chomskian r e v o l u t i o n i t s e l f came under a t t a c k . L i n g u i s t s such as G . L a k o f f (1971) s t a r t e d what became known as the g e n e r a t i v e semantics movement which attempted to p o i n t out flaws i n the Chomskian view of language and which expanded the scope of the l i n g u i s t i c endeavour with the hope t h a t t h i s broader view would overcome the problems. Generative s e m a n t i c i s t s see a more c e n t r a l r o l e f o r semantics i n the study of language to account f o r t h i n g s (such as scoping phenomena i n v o l v i n g q u a n t i f i e r s and negation) t h a t d i r e c t l y a f f e c t the s u r f a c e s t r u c t u r e without any intermediate s y n t a c t i c phase. Chomsky (1971) has responded to these c r i t i c i s m s with some m o d i f i c a t i o n s to h i s theory and with the c l a i m t h a t g e n e r a t i v e semantics i s a "mere n o t a t i o n a l v a r i a n t " of h i s theory. I don't want to get embroiled i n t h i s d i s p u t e , my p o i n t being merely t h a t i n recent times the semantic l e v e l i s coming more and more i n t o play (see Leech (1974) f o r a comprehensive d e s c r i p t i o n o f the r e l a t i v e m e r its of c u r r e n t semantic t h e o r i e s ) . The second trend I see as being r e l e v a n t to the r e s e a r c h r e p o r t e d here i s the trend t o b l u r r i n g the r i g i d borders s e p a r a t i n g the v a r i o u s l e v e l s of l i n g u i s t i c d e s c r i p t i o n . I've Chapter I 4 already mentioned that semantic phenomena can influence surface structure without going through syntactic deep structure. Even phonetics sometimes seems to influence semantics. For example, discovering pronoun references seems to have a large semantic dimension, but i t i s n ' t s t r i c t l y semantic as the following example shows: the sentence "George always wanted to be a g u i t a r i s t but i t wasn't the instrument that suited him best." i s acceptable, but "George always wanted to be a f l a u t i s t , but i t - * wasn't the instrument that suited him best." i s not, at least p a r t i a l l y because the word " f l a u t i s t " i s morphemically further removed from " f l u t e " than " g u i t a r i s t " i s from "guitar" {this example i s based on observations by Lakoff and Ross (1972)). This trend has been emphasized i n recent times by the appearance of word based case theories of language (Fillmore (1968), Chafe (1970)) which place l i n g u i s t i c information i n case frames associated with words. Each such case frame i s responsible for " f i l l i n g i n s l o t s " for that word appropriate to the context in which the word appeared. Computer based case models (e.g. Taylor and Rosenberg (1975) , flartin (1975)) have tended to deepen the case frames so they can do semantic and even pragmatic processing as well as the more syntactic things suggested by the e a r l i e r case theories. Many of these models have proven to be extremely successful for the domains i n which they have been applied. In any event the second trend i s the ever increasing attempt to apply whatever information i s necessary, be i t phonetic, syntactic, semantic, or pragmatic, whenever i t i s necessary. Chapter I 5 The th i r d major l i n e of development has been the increasing i n t e r e s t i n models of language which treat language as i t i s used rather than as some ideal grammatical abstraction. This i s , of course, guite contrary to the competence / performance d i s t i n c t i o n , a d i s t i n c t i o n which has been successful because i t has enabled language to be studied i n r e l a t i v e i s o l a t i o n from the r e a l world. However, I believe t h i s i s o l a t i o n has generated many fa l s e issues such as an inordinate concern with asterisking sentences which would be acceptable i n some d i a l e c t s and whose meaning would be clear i n most di a l e c t s , but which nevertheless are considered as counter examples to various proposed schemes. Another example: the raging debate that often arises over whether two sentences are synonymous when the ground rules as to the depth of analysis from which to view the sentences aren't c l e a r . The attempt by philosophers of language to view language i n terms of i t s intended e f f e c t on the hearer seems to avoid many of these f a l s e issues (while doubtlessly creating i t s own) by focussing on the r e a l purpose of language: the communication of ideas. Hence, s l i g h t deviations i n the surface structure which don't aff e c t the meaning are not important; two sentences are synonomous i f t h e i r intended e f f e c t on the hearer i s i d e n t i c a l . Of particular i n t e r e s t here are the Gricean approaches of giving "rules of conversation" (1968) and giving i n t e n t i o n a l d e f i n i t i o n to utterances (1959), and the speech acts theory (Austin (1962), Searle (1969)) . The trend to viewing language in a more natural s e t t i n g has Chapter I 6 been evident i n a r t i f i c i a l i n t e l l i g e n c e as w e l l . E a r l i e r systems s e v e r e l y r e s t r i c t e d the domain of study to g u e s t i o n answering (e.g. Schwarcz e t a l (1970)), b l o c k s worlds (e.g. Hinograd (1972)), b a s e b a l l s t a t i s t i c s (Green e t a l (1963)), f a m i l y r e l a t i o n s h i p s (Lindsay (1963)), b e l i e f systems ( T e s l e r et a l (1968)), and so on. But more r e c e n t l y ever broader views of language have been taken, so t h a t Schank's system (1972), a l r e a d y g u i t e comprehensive, when extended by s c r i p t s (Schank and Abelson (1975)) became even more g e n e r a l . Charniak's (1972) work on s t o r i e s has been extended to f u l l s c a l e frame d e s c r i p t i o n s (Charniak (1975)) of language s c e n a r i o s . Bruce (1975) has been concerned with l a r g e paradigms of s o c i a l a c t i o n as they apply t o language. P. Cohen (1977) i s s t u d y i n g s e v e r a l c o n v e r s a t i o n a l s c e n a r i o s using a methodology based on a computational d e s c r i p t i o n of speech a c t s . Winograd (1976, 1977) i s concerned with f o r m u l a t i n g a g e n e r a l , pragmatics c e n t r e d , model of language. This search f o r g e n e r a l i t y i s a m a n i f e s t a t i o n of trend 3; t r y i n g to view language i n use. These three trends are not d i v e r g i n g ; r a t h e r , they seem to be coming together i n t o a s i n g l e viewpoint: language should be s t u d i e d as i t i s used with semantic and pragmatic i n f o r m a t i o n d r i v i n g the more purely s u r f a c e aspects. However, t h i s s houldn't p r e c l u d e knowledge from whatever l e v e l being a p p l i e d when r e l e v a n t . These are the reasons why c o n v e r s a t i o n , a domain i n which language i s used as n a t u r a l l y as p o s s i b l e and a domain i n which semantic and pragmatic c o n s i d e r a t i o n s are of utmost Chapter I 7 importance has been chosen for study. 1.2 Issues and Limitations Studying conversation has at least one po t e n t i a l l y serious drawback: i s i t too big a topic to handle? The answer i s that i n i t s f u l l generality conversation i s probably currently i n t r a c t a b l e . But i f certain r e s t r i c t i o n s are enforced, I believe progress can be made. The f i r s t r e s t r i c t i o n i s the l i m i t a t i o n to the study of a p a r t i c u l a r conversational s i t u a t i o n . Proposed i s a concert scenario, which at the same time i t i l l u s t r a t e s much in the way of importance about conversation also helps to cut down the scope of the project. The scenario involves conversations which would take place during the events surrounding a symphony concert. Three p a r t i c u l a r conversations have been singled out: (i) a conversation between a t i c k e t s e l l e r and a concert patron whose aim i t i s to buy a t i c k e t to the concert; (ii ) a conversation between a bartender and a concert patron whose aim i t i s to buy a drink at intermission of the concert; ( i i i ) a conversation between two concert patrons who unexpectedly meet at intermission. Even these r e s t r i c t i o n s have been further hedged i n that conversations (i) and ( i i ) are "task-oriented" (Deutsch (1975)) and hence somewhat predictable; and conversation ( i i i ) , which i s much more f l e x i b l e and hence much harder, has been given rather Chapter I 8 cursory analysis. A second r e s t r i c t i o n i s that the issues studied here have been limited. In l i n e with the focus on the pragmatic and semantic lev e l s the following have been of central concern: (i) -L whether world and l i n g u i s t i c knowledge can be e f f e c t i v e l y combined, and i n particular whether language can be viewed as an a c t i v i t y l i k e any other; (i i ) -L how the goals of a conversant a f f e c t what he says and how he understands; ( i i i ) -L how the knowledge a conversant has about the other conversants a f f e c t what he says and how he understands; (iv) -L how the conversant i s able to focus on the relevant aspects and ignore the ir r e l e v a n t aspects of any conversational scenario. Many more issues of potential relevance have not been of prime concern. For example: a detailed analysis of l i n g u i s t i c surface phenomena; an adequate treatment of the problem of generation i n any r e a l l y deep way; the phonetic or morphemic aspects of language; a sophisticated approach to the problem of reference; how a conversant i s able to deal with massively unexpected utterances or other surprises; and so on. I t must be noted, however, that since most of these problems (and others as well) unavoidably intrude, the thesis does make some commitment to the nature of possible solutions even i f no hard answers are provided. A t h i r d aspect which aids in making conversation a reasonable domain of study i s the methodology chosen to test out Chapter I 9 ideas: building a computer model of the behaviour of one participant i n a dialogue. While simplifying the problem by eliminating half of each dialogue, this viewpoint-dependent approach means that the issues of goal direction and conversant modelling become p a r t i c u l a r l y relevant, thus further focussing the research. Moreover, computer modelling, of i t s e l f , gives added hope to the approacha.bil.ity of conversation as a domain of research. Not only i s the attempt to write code for a problem a good way of c l a r i f y i n g ideas, but the process metaphor i s a powerful one, one that suggests many intere s t i n g and useful constructs (see Minsky's (1970) Turing award lecture for a masterful description of thi s aspect). Once t h i s methodology i s chosen, however, many hard decisions must be taken as to which a r t i f i c i a l i n t e l l i g e n c e issues are of importance and which are not. The following seem to be of c r u c i a l relevance: (i) -R the conglomeration of procedural and declarative information of various sorts into one place, since the model obviously has to both know things and know how to do things; ( i i ) -R the whole problem of accessing t h i s knowledge; that i s , the decision as to how and when to search for information, issues of inheritance of general information (see Levesgue (1977) for example), the nature of inferencing, the problem of procedural attachment (Winograd (1975)); ( i i i ) -R the necessity for some sort of context mechanism (of p a r ticular relevance to issue ( i v ) - L ) ; (iv) -R the need to keep a record of processing decisions. Chapter I 10 not only to allow the model to keep track of what has just been said but also to allow i t to reason about i t s own behaviour (see issue ( i i ) - L p a r t i c u l a r l y ) ; (v) -fi the building in of robustness, so that when something f a i l s , appropriate explanations, excuses, or f a i l u r e processing can be entered into; (vi) -R because t h i s i s a big undertaking, the standard a r t i f i c i a l i n t e l l i g e n c e issues of complexity and combinatorial explosion. Many other issues, such as non-goal-directed processing (a c a t c h - a l l term f o r things l i k e associative a c t i v a t i o n , bottom-up processing, demons, forward inferencing), e f f i c i e n c y of execution, economy of storage, convenience of notation, planning, learning, etc., etc. are dealt with, i f at a l l , at best peripherally. The fact that only certain representation issues (albeit large ones) have been considered hopefully adds to the f a c i l i t y with which conversation as a domain can be approached. F i n a l l y , i t should be emphasized that even the issues which are c e n t r a l are only p a r t i a l l y analyzed r e l a t i v e to the vast amount that could be said. I merely propose one approach which may suggest i n t e r e s t i n g things about these issues and which with further experimentation might find wider a p p l i c a b i l i t y i n the modelling of conversation (and perhaps in other areas). Chapter I 11 1-1 What«s Proposed? The investigations into the issues raised i n the l a s t section tend to be c y c l i c a l , with language issues r a i s i n g representation issues which r e f l e c t back into language and so on back and forth. Thus i t i s that the ideas proposed herein are not some "cast i n concrete" f i n a l version, but much more a snapshot of my current thinking. With t h i s preamble as a backdrop, I would l i k e to indicate the major concepts contained in the thesis. The discussion i s s p l i t into two parts: concepts of representation and concepts of language. 1*2.-1 Concepts of Representation A prerequisite to the study of a large domain such as conversation i s that some sort of approach to the representation of knowledge be delineated. The representational scheme proposed here has the following main c h a r a c t e r i s t i c s : (i) It i s modular, allowing many diff e r e n t kinds of objects to co-exist together. Objects are opague to one another and can communicate only by passing messages., Such modularity, i t i s hoped, w i l l help solve some of the complexity issues (issue (vi) -R) . (i i ) The most inter e s t i n g such object, c a l l e d a pattern expression (JPEXPR) i s roughly based upon the frame idea of Minsky (1974). Most domain knowledge i s represented i n such objects as patterns^ Since these patterns can ije s t a t i c or can contain certain "active" macro elements, either procedural or Chapter I 1 2 declarative information can be encoded (issue (i)-R). ( i i i ) Messages to a | PEXPR are also patterns that are handled by matching them against patterns in the | PEXPR. , Since message passing i s defined for a l l kinds of patterns, i n pa r t i c u l a r procedural and declarative patterns are accessed uniformly {issues (i)-R and (ii)-S) . (iv) I f a message pattern cannot be matched i n a |PEXPR, f a i l u r e to match processing (associated with patterns of that type) can take place. This can range from trying to " i n h e r i t " the pattern through performing arbitrary inferences to giving up completely (this addresses issues ( i i ) - R and (v)-R). (v) A by-product of message passing i s the creation of an ac t i v a t i o n record to which temporary variables and other l o c a l e f f e c t s of the message passing are r e s t r i c t e d . This a c t i v a t i o n record i s c a l l e d an execution instance and i s a pattern expression l i k e any other (and hence able to be accessed i n i d e n t i c a l fashion to other JPEXPRs (issue (vi)-R)). (vi) As i t handles a message, a pattern expression may need to communicate with another pattern expression., Whole chains of messages can be set up t h i s way, creating e n t i r e chains of execution instances. They form a dynamic environment (akin to that of ALGOL or LISP) c a l l e d the execution environment which turns out to be a very useful focussing and context mechanism (issue ( i i i ) - R , issue ( i v ) - L ) , as well as allowing the discovery of current goals (relevant to issue ( i i ) - L ) . (vii) Execution instances are not automatically removed af t e r a message i s answered. Instead, they stay around and old Chapter I 13 chains of them are consequently preserved. Such venerable execution environments can be accessed i f the d e t a i l s of what went on i n the past are needed. They thus give the model a sort of episodic memory {issue ( i i ) - B ) . 1-3.2 Concepts of Language The viewpoint of thi s research i s that l i n g u i s t i c c a p a b i l i t i e s are subgoals of no n - l i n g u i s t i c c a p a b i l i t i e s . Thus, the easiest way to describe t h i s approach to language i s i n terms of " l e v e l of goal", from higher l e v e l e x t r a - l i n g u i s t i c goals through lower l e v e l goals that are c a l l e d in to understand p a r t i c u l a r parts of an utterance. Each such goal i s modular in that i t can be more or les s separated from other goals, and each i s therefore encoded as a pattern expression. Since goals can c a l l in subgoals a r b i t r a r i l y , i t i s sometimes rather hard to c l a s s i f y them precisely; they do seem, however, to roughly f a l l i n t o four main l e v e l s : the non-linguistic l e v e l , the s c r i p t l e v e l , the speech act l e v e l , and the language l e v e l . (i) n o n - l i n g u i s t i c goals: Goals at t h i s l e v e l undertake s i g n i f i c a n t plans of action such as, for example, attending a concert, buying a tic k e t to the concert, etc. Not primarily concerned with language, they do, however, know enough to c a l l i n l i n g u i s t i c subgoals when appropriate (e.g. to talk to the t i c k e t s e l l e r ) . Perhaps as importantly, much of what i s said i s interpreted or produced i n the context created by t h i s l e v e l , giving i t focus and di r e c t i o n . ( i i ) s c r i p t s : S c r i p t s are subgoals of non-linguistic goals Chapter I 14 (or higher l e v e l scripts) c a l l e d i n to actually d i r e c t a conversation (e.g. the s c r i p t to direct the buying of something such as a t i c k e t ) . They are responsible f o r keeping track of the utterances of a l l parties to a conversation, for determining the seguence of speaking, for recognizing the beginnings and endings of a conversation, for using s c r i p t expectations to aid the interpretation and production of utterances, and f o r meshing these expectations with the actual utterances produced. Scr i p t s have avai l a b l e to them models of the conversants for use i n performing their varied tasks. ( i i i ) speech acts: Speech acts (e.g. inquire, respond, inform) represent ideas expressible i n a single verbal action by a lone speaker (the name has been chosen because of the s i m i l a r i t y of t h i s l e v e l to the l e v e l of analysis of the speech acts of Austin (1962) and Searle (1969)). Called i n by s c r i p t s , speech acts are responsible for interpreting or producing actual utterances, for checking that the utterance i s not i n c o n f l i c t with the special requirements of a speech act of i t s type, and for making sure the utterance doesn't v i o l a t e anything known about the conversant (available from the conversant model). Speech acts sometimes deal d i r e c t l y with surface l i n g u i s t i c s t r i n g s , but more often c a l l i n language l e v e l pattern expressions to buffer them from the " r e a l world". (iv) language l e v e l goals: The s p e c i a l i t y of t h i s l e v e l of analysis i s language i t s e l f . Thus, there are pattern expressions which know about noun groups, verb groups, clauses, utterances, etc. I f any l e v e l i s the t r a d i t i o n a l parsing l e v e l . Chapter I 15 t h i s i s i t , although the methods are not as i n f l e x i b l e as the usual parsing image suggests. The primary task of any goal at t h i s l e v e l i s to transform a raw set of words into i n t e r n a l concepts, a task which involves appropriately grouping words (syntax), performing checks that the groups are consonant with known information discovered i n memory or in the currently relevant execution environment (semantics), and occasionally doing other tests perhaps involving such pragmatic considerations as looking at the conversant model (not d i r e c t l y a v a i l a b l e , but discoverable in the execution environment) or conceivably performing more es o t e r i c inferences. Much else obviously i s involved i n language, and such aspects as encoding s t a t i c (non-procedural) information, handling associative a c t i v a t i o n , doing bottom-up processing, performing morphological trimming, are touched upon i n the thesis i n varying amounts of d e t a i l . However, the core of the analysis centres around the four levels just described. V. 4 Organization of the Thesis The rest of the thesis i s organized as follows: Chapter II gives further d e t a i l s about conversation as a domain of study; Chapter III proposes a scheme for representing knowledge; and i t i s evaluated as to h i s t o r i c a l influences, strengths, and weaknesses in Chapter IV; a detailed example of the representation handling a conversation i s shown in Chapter V; Chapter VI gives some generalizations that can be extracted from Chapter I 16 the example as well as suggesting some extensions to the system; Chapter VII sums up a l l that has gone before. In addition to the main body of the thesis, there are two Appendices: Appendix I, containing a description of many of the important objects i n the representation, and Appendix II with some of the more elaborate pattern expressions used in the extended example of Chapter V. F i n a l l y , an Index of important terms and concepts i s included. Chapter I 17 CHAPTER II Analyzing Conversation As I mentioned i n Chapter I, there seems to be a recent trend i n l i n g u i s t i c s and a r t i f i c i a l i n t e l l i g e n c e to deepen the l e v e l of analysis of language, to reformulate t r a d i t i o n a l l i n g u i s t i c d i s t i n c t i o n s , and to consider language as a performance phenomenon!. Conversation, with i t s emphasis on using language to communicate ideas among conversants, i s an i d e a l "experimental laboratory" i n which to c a p i t a l i z e on these trends. Over and above t h i s , conversation has many merits on i t s own as a research area. It i s an area of l i n g u i s t i c performance where pragmatic considerations are uppermost, where things l i k e models of the conversant, goals, context, etc; can be studied not as afterthoughts or i n some secondary r o l e , but as central concerns that i n cer t a i n respects are even more important than the analysis of actual utterances. Conversation i s an area where many multi-person interactions must be accounted f o r including the sequencing of utterances, the determination of who should speak when, the discovery of what each conversant i s expected to say both in r e l a t i o n to his goals and i n accordance with what has been said so f a r , and the a b i l i t y to interleave the production and i n t e r p r e t a t i o n of utterances. Even within s i n g l e utterances, a l l manner of i n t e r e s t i n g phenomena present themselves, e s p e c i a l l y the problem of p a r t i a l utterances which Chapter II 18 need context to make them comprehensible, the problem of ungraramatical utterances, and the obvious need to handle multiple sentence constructions. Conversations are connected discourses, not is o l a t e d sentences. Thus, some sort of representation of what has been said (and why) i n a conversation, how the various utterances connect to one another, who spoke each utterance must be stored i n a form which can l a t e r be accessed and referred to. There seem to be many di f f e r e n t types of conversation, each with i t s own peculiar c h a r a c t e r i s t i c s and each imposing a greater or lesser degree of top-down control over what i s said. There are very r i g i d conversational formats, such as r i t u a l i z e d ceremonial exchanges where even the actual words are prescribed. Less r i g i d , but s t i l l very top-down, are task-oriented dialogues (Deutsch (1974)) such as a conversation to order a meal i n a restaurant or buy a t i c k e t to a concert. Extremely f l e x i b l e kinds of conversation take place in many "debating" si t u a t i o n s {e.g. dinner table chatter, talking with a friend) where i t i s v i r t u a l l y impossible to determine what i s going to be said next. This wide range of conversation types i l l u s t r a t e s the issue of expectation versus r e a l i t y (and the attendant issues of excusing or explaining anomalies, passing control appropriately, etc.) i n that certain types w i l l be more amenable to change than others. Moreover, the existence of" these types allows a few to be chosen for extensive analysis, thus hopefully l i m i t i n g the problem somewhat while s t i l l maintaining most of the features desired. In sum, then, conversation i s a good area for exploring Chapter I I 19 language because i t doesn't a r b i t r a r i l y r e s t r i c t the domain of study. To explain, or even to begin to explain, what i s going on i n a conversation, the vast number of things mentioned here must be studied at least a l i t t l e , and the t i e i n g together of these things must y i e l d insights into language at a l l l e v e l s . The view of t h i s research i s that broadening the study of language to a large domain such as conversation w i l l resolve or make irrelevant many d i f f i c u l t i e s encountered by more r e s t r i c t e d viewpoints. 2.2 Background The attempt to model conversation has not arisen in a vacuum. In t h i s section I would l i k e to very b r i e f l y look over research pertaining to the analysis of conversation that has been developed in a r t i f i c i a l i n t e l l i g e n c e , l i n g u i s t i c s , philosophy of language, s o c i o l i n g u i s t i c s , and elsewhere. Naturally, there i s a vast amount of relevant work, and i n what follows I can only hope to suggest various influences rather than give a detailed description of every piece of research. More s p e c i f i c debts are noted at appropriate places throughout the thesis. S o c i o l i n g u i s t i c s i s one area concerned with issues of d i r e c t relevance to the modelling of conversation since i t i s concerned with examining language in i t s s o c i a l context. Work by Schegloff (1971) on sequencing, Garfinkel (1972) on s o c i a l expectations, Linde (1974) on the choice of determiners i n Chapter II 20 verbalizing i n t e r n a l concepts, Goffman (1974) on "frame analysis" of language, and the l i k e , i s i n d i c a t i v e of the importance placed on the non-linguistic aspects of language use. Most of t h i s work has been i n f l u e n t i a l to t h i s research i n delineating general approaches rather than i n yielding s p e c i f i c suggestions. Philosophy of language also makes a commitment to language as i t i s used rather than to some more r e s t r i c t e d view. Thus, Grice (1957) defines language i n terms of i t s intended effect on the hearer, the speech acts paradigm (Austin (1962), Searle (1969)) looks on language as composed of primitive units of meaning (the speech acts), and Grice (1968) and E. Lakoff (1973) attempt to formulate rules of conversation which not only guide speakers but which also form the basis for appropriately judging deviant utterances., Once again, the influence of philosophy of language research to this work has been a general one except, of course, for the speech acts model, some aspects of which have been incorporated f a i r l y d i r e c t l y . In l i n g u i s t i c s proper, the major influence on t h i s work ari s e s manily through the case grammar movement spearheaded by Fillmore (1968) and Chafe (1970). Case grammar, focussing as i t does on l o c a l , word based parsing methods, i s useful i n at least two ways: (i) i t suggests a means of handling the p a r t i a l and ungrammatical utterances rampant in conversation, i n that a case frame i s able to pick and choose what i t needs from an utterance, ignoring extraneous words and substituting i t s own Chapter II 21 default expectations for non-existent parts of an utterance; and (ii) the case frame concept can be r e a d i l y "deepened" to include the necessary semantic and pragmatic checks, an absolute necessity in a domain such as conversation. In f a c t , computational l i n g u i s t s such as Martin (1975) and Taylor and Rosenberg (1975) have done exactly t h i s with considerable success. That case frames l i k e l y need to be deepened s t i l l more i s evident from the more recent work of Fillmore (1975) who i s looking at frames for encoding extremely pragmatic kinds of information. Fillmore (as does Chafe (1975)} even suggests the need for a l e v e l of information almost completely removed from language. Obviously, such considerations are not out of l i n e when tryi n g to account for the many real world influences on conversation. Perhaps the main i n s p i r a t i o n for conversation as a f e a s i b l e domain of study (and also, as w i l l be seen, f o r many of the methods employed i n that study) has been the progress i n a r t i f i c i a l i n t e l l i g e n c e natural language models. Recently there has been an attempt to describe language in much more comprehensive terms than had been the case up to that time. Winograd's (1972) work, while l i m i t i n g the domain of study to the blocks world, accounts for an in t e r e s t i n g array of l i n g u i s t i c phenomena, including the c a l l i n g i n of procedural semantics at an appropriate time by a very comprehensive syntactic component, the use of history l i s t s that enable the model to discuss previous episodes i n the dialogue, the usefulness of r e a l world knowledge in helping to disambiguate Chapter I I 22 sentences. Moreover, the surface language handled by Winograd's system was extremely sophisticated compared to anything that had been done before., Woods et al (1972) have also achieved impressive performance i n the LUNAfi system by using a representational scheme (augmented t r a n s i t i o n networks) which allows information to be used when appropriate and which, because i t has a visu a l description ( i . e . graphs can be drawn representing a pa r t i c u l a r ATN's flow of control) gives great perspicuity and hence allows large parsers to be b u i l t within the "complexity b a r r i e r " (a term used by Winograd (1974)). Schank (1972) has been a pioneer in deepening the focal point of language analysis to semantics - almost a l l interpretation and production of surface language i n the various Schank systems has been directed by the desire to f i l l i n conceptual dependency s l o t s . More recent work (Schank and Abelson (1975)) has further deepened the analysis to pragmatic issues and has attempted to account for how certa i n kinds of conversations are undertaken with top-down d i r e c t i o n by processes c a l l e d s c r i p t s . Charniak's (1972) model attempts to understand connected discourse, s p e c i f i c a l l y children's s t o r i e s . The demon model which he proposes there, while containing many flaws, has provoked research into how to use more controlled kinds of processing. For example, Minsky's (1974) frame proposal has been, in part, an attempt to overcome the uncontrolled inferencing of demon models. Interestingly enough. Chapt er II 23 Charniak {1975) himself has adopted some aspects of the frame proposal to the modelling of episodes i n a supermarket, a s i t u a t i o n where pragmatic context has been considered a l l important to appropriate l i n g u i s t i c processing. Another attempt to embed language analysis in a larger context has been Bruce's (1975) work with s o c i a l action paradigms containing knowledge about stereotyped s o c i a l s i t u a t i o n s . Perhaps the most important development suggesting that conversation's time has come i s the beginnings of the development of other models of conversation i n a r t i f i c i a l i n t e l l i g e n c e . Deutsch (1974) has already been mentioned f o r her work on task oriented dialogues; P. Cohen (1977) has been concerned with developing a model explaining conversations which take place at the checkout counters of supermarkets; Horrigan {1977) delineates s c r i p t s for a couple of task oriented dialogues; CAI systems (see C o l l i n s and Grignetti (1975)) have been simulating r e a l i s t i c natural language dialogues between student and tutor., Hinograd (1977) suggests some prerequisites fo r a model of dialogue. . The expanding e f f o r t on the conversation front i s encouraging. 2.2 Issues The many possible issues suggested in the l a s t couple of sections have been winnowed to the following "big four": (i) whether world and l i n g u i s t i c knowledge can be e f f e c t i v e l y combined (or, indeed, i s there a d i s t i n c t i o n ? ) ; Chapter II 2H ( i i ) how the goals of a conversant a f f e c t what he says and understands; ( i i i ) how the knowledge of a conversant about himself and the other conversants a f f e c t what he says and understands; (iv) how the conversant i s able to use context to enable him to focus on the relevant and ignore the i r r e l e v a n t . In t h i s section I would l i k e to elaborate why I think these issues are important. (i) combining world and l i n g u i s t i c knowledge: Probably the main problem that arises i f conversation i s to be successfully analyzed i s how to put a vast amount of knowledge of various sorts together i n one place. There are many dimensions along which to categorize t h i s knowledge. A model of conversation needs to have information about various d i f f e r e n t subjects. Thus, i t needs knowledge about language i t s e l f , i . e . how to r e l a t e words to concepts; how to i n t e r p r e t and produce single utterances; how to handle multiple utterances (perhaps by several different conversants).. I t needs knowledge about the topic under discussion, so that i f a t i c k e t buying conversation i s i n i t i a t e d , knowledge about ticket prices, t i c k e t locations, tradeoffs between these, etc. w i l l be needed. I t needs knowledge about the conversants, so that i n the t i c k e t buying s i t u a t i o n the desires and motivations of each conversant need to be taken into account. Along the procedural / declarative dimension, a model of conversation has to allow for more or less s t a t i c facts Chapter II 25 (e.g. cost of a t i c k e t , location of a concert), but also must be concerned with actually doing things (e.g. interpreting or producing an utterance, engaging in a conversation) . Another kind of knowledge can be categorized according to what Schank (1974) terms the episodic / semantic memory d i s t i n c t i o n . Clearly a conversation model needs to have episodic c a p a b i l i t i e s (i.e.; a memory of events) not only as to what actually happened in the past but also as to how the model perceived what happened i n the past. But just as c l e a r l y , any such model would need a semantic memory containing s p e c i f i c knowledge about l o c a l things (e.g. location of a pa r t i c u l a r seat i n a theatre) a l l the way up to general rules (e.g. the fac t that people have two legs or a rule for accomplishing some class of tasks) . There are, no doubt, many other kinds of knowledge needed. Regardless, the point i s that a major (in many ways the major) problem i s to f i n d some sort of scheme that allows appropriate information to be available at the right time while s t i l l being comprehensible to the modeller. {ii) qoalinq: Under the c a t c h - a i l heading of "goaling" are actually at least two sub-issues: how a model's non-l i n g u i s t i c goals a f f e c t i t s l i n g u i s t i c goals; and vice versa. That non- l i n g u i s t i c goals are c r u c i a l to conversation i s f a i r l y obvious at a number of l e v e l s . F i r s t , i t i s clear that conversations are entered into to achieve subgoals of non-li n g u i s t i c processes. Por example, a Chapter II 26 t i c k e t buying conversation i s undertaken to obtain a t i c k e t f o r some higher l e v e l goal such as the goal of attending a concert. And, because a n o n - l i n g u i s t i c goal "sets the stage" for a l l that follows, the interpretation and production of utterances i s strongly affected by the goal. In the t i c k e t buying conversation, for example, there should be no problem in t e r p r e t i n g things associated with t i c k e t s , money, seat locat i o n s , etc., but talk of zoos, battleships, f l y i n g saucers, or the l i k e , would seem out of place. Non-linguistic goals are often d i r e c t l y queried i n a conversation, for instance by a t i c k e t s e l l e r asking a buyer what he wants at the beginning of a conversation. F i n a l l y , the importance of a n o n - l i n g u i s t i c goal can determine how perservering a conversant i s i n continuing a conversation. Thus, a door-to-door salesperson i s very persistent i n trying to talk to a householder despite open hints of h o s t i l i t y because the goal of s e l l i n g the product reguires such diligence. It i s also f a i r l y evident that l i n g u i s t i c goals a f f e c t n o n - l i n g u i s t i c goals, although i n a somewhat les s domineering fashion. Thus, what i s said can r e f l e c t back in t o and perhaps even a l t e r a n o n - l i n g u i s t i c goal, so that i f a discussion with a t i c k e t s e l l e r indicates there are no t i c k e t s l e f t , c l e a r l y the goal of attending the concert i s no longer v a l i d . More subtly, a l i n g u i s t i c goal can actually c a l l i n a n o n - l i n g u i s t i c subgoal ie.g. moving closer to better hear what i s said) or can be interleaved with a n o n - l i n g u i s t i c goal (e.g^ exchanging money for a t i c k e t during a conversation to buy a t i c k e t ) . Chapter II 27 From th i s discussion i t should be clear that the intermeshing of l i n g u i s t i c and non-linguistic goals i s an important aspect of the modelling of conversation. ( i i i ) modelling conversants: Another obviously important aspect i n the processing of conversation i s using models of the conversants to help in the disambiguation and production of utterances. Cl e a r l y , who i s tal k i n g i s c r u c i a l at a l l l e v e l s of the l i n g u i s t i c endeavour: the type of conversation i t s e l f may be determined by the conversants (some married couples, for example, may be unable to engage in any kind of conversation except a vigourous debate); the p a r t i c u l a r utterances within a conversation may be strongly influenced by the conversant (e.g. when talking to a child c e r t a i n subjects would be avoided); the s t y l e may depend on who i s being talked to (e.g. the language of a clerk when talking to his boss i s much more constrained and formal than when talking to his mate at the next desk); and even ce r t a i n speech patterns and guirks of phraseology (e.g. " Y ' a l l come back now, y'hear?") could be expected to change as the conversant changes. Conversant models seem to be useful, as well, in helping to formulate concepts to verbalize. In certain rather undirected conversational scenarios (e.g. coffee break conversations, conversations with f r i e n d s ) , deciding what to say next i s pretty much independent of current goals. One possible strategy i s to use models of the conversants to compare what i s said to the b e l i e f s of the various conversants. Notable contradictions or Chapter II 28 s i m i l a r i t i e s could form the basis of a response. Altogether, conversant models are c r u c i a l to adequate processing of conversation. (iv) context: From the above discussion i t should be clear that some sort of context mechanism i s needed to focus in on only the relevant aspects of any si t u a t i o n . This i s necessary not only to keep combinatorics and complexity i n l i n e , but also to arrive at the proper interpretation for utterances. Thus, "They are f l y i n g planes.", a famously ambiguous sentence, i s t o t a l l y unambiguous i n the si t u a t i o n where a f l e e t of airplanes i s buzzing overhead. The sentence "The brown hairy animal ran after the d i r t y green car." might actually be r e f e r r i n g to a pa r t i c u l a r dog, "Buff", chasing a par t i c u l a r car, "Smedley H i t t i t e * s mangy old Volkswagen" i f the context i n which i t i s uttered has foregrounded these concepts. Many other reference problems depend on the adequate handling of contextual information. 2*3. Levels of Analysis The issues of section 2.2 i l l u s t r a t e the need to view language in a wider context than just the processing of surface s t r i n g s . One possible analysis involves viewing l i n g u i s t i c goals i n the same terms as other goals of the model. Generally speaking, non-linguistic goals s i t on "top" of the goal hierarchy and from there c a l l in lower l e v e l l i n g u i s t i c goals Chapter II 29 such as s c r i p t s , speech acts, and language l e v e l goals, when necessary. (i) n o n - l i n g u i s t i c goals: Much of any r e a l i s i t i c conversation i s concerned with things that aren't l i n g u i s t i c at a l l . As mentioned e a r l i e r , any conversation i s driven by n o n - l i n g u i s t i c goals; e.g. attempting to buy a t i c k e t , trying to buy a drink, meeting an acquaintance a l l reguire subgoals involving conversations These conversation subgoals are of the same " s t u f f " as the non-conversation goals; so, i f they l i k e , they can c a l l i n non-linguistic processing, including such things as exchanging money for t i c k e t s , motor actions, and the l i k e , or they can invoke further l i n g u i s t i c subgoals. E x t r a - l i n g u i s t i c (but non-goal oriented) information, avai l a b l e at a l l l e v e l s , i s espe c i a l l y important at the non-lin g u i s t i c levels,* I t i s at this l e v e l , for example, that the conversants are recognized and pointers to conversant models (which themselves consist mainly of s t a t i c e x t r a - l i n g u i s t i c information) are recorded for use at a l l l e v e l s . Information as to the focus of attention of the model i s also present at t h i s l e v e l . These examples are t y p i c a l of the non-l i n g u i s t i c l e v e l : the goal i t s e l f and e x t r a - l i n g u i s t i c information available from the goal help focus things further down i n the goal hierarchy. ( i i ) s c r i p t s : Scripts are the highest l e v e l of l i n g u i s t i c goal. They are Chapter II 30 invoked usually as subgoals of non - l i n g u i s t i c goals (e.g. the s c r i p t to direct the dialogue to buy a ticket i s c a l l e d i n by the no n - l i n g u i s t i c goal directing the buying of the t i c k e t ) , but can be c a l l e d i n by other s c r i p t s as well (e.g. a subgoal of the buy conversation s c r i p t i s a greeting s c r i p t that helps est a b l i s h the conversational roles of the speakers). A s c r i p t ' s primary task i s to keep track of utterances on a l l sides of a conversation. It must not only determine who should speak when and, depending on the i d e n t i t y of the speaker, i n t e r p r e t or produce an utterance, but i t must also set up some sort of expectation as to what the content of each utterance w i l l be. If the utterance i s to be produced, then t h i s content forms the basis of the actual utterance generated; i f the utterance i s to be interpreted, then this expected content should serve as an aid to understanding the surface utterance. I f notable differences are found between expectations and r e a l i t y , the s c r i p t i s responsible for explaining them. A s c r i p t must also keep a record of any conversation i t d i r e c t s . A s c r i p t has available to i t the models of the conversants discovered at the non-linguistic l e v e l . In many situations s c r i p t s w i l l access information i n these conversant models to determine that verbalizations are consonant with the b e l i e f s of the conversants, to try to f i n d something to say, etc. ( i i i ) speech acts: It has already been explained that s c r i p t s can c a l l i n subscripts; what hasn't been spelled out i s that s c r i p t s can Chapter II 3 1 also c a l l in subgoals that involve i n t e r p r e t i n g or generating the speech of a single speaker. Such single verbal subgoals are c a l l e d speech acts after the Austin / Searle nomenclature. Thus, a s c r i p t could expect a conversant to undertake an "inquire" act or a "respond" act or an "agree" act etc. A speech act i s responsible for either generating or in t e r p r e t i n g an utterance, depending on who the speaker i s . In the former mode i t takes an expectation as to the content of the speech act and builds a surface utterance which i s then actually "spoken" (i.e. printed) under control of the act. In the l a t t e r case the speech act " l i s t e n s " to ( i . e . reads) a surface utterance and t r i e s to interpret i t i n a way which i s both consonant with the act (e.g. "yes" w i l l be interpreted by an "inquire" act as a question but by an "agree" act as a statement) and with the expected content (e.g. i f the expected object of an "inquire" i s the health of the hearer, then a statement such as "How about you?" must be an inguiry into the hearer's health rather than, say, into h i s desire to do something). Conversant models are available at t h i s l e v e l as well, since to properly undertake a speech act may very well involve looking into the b e l i e f s of the conversant. F i n a l l y , a speech act records for posterity the actual surface utterance, the actual content, and the speaker of and l i s t e n e r (s) to the speech act. {iv) language l e v e l goals: Sometimes a speech act w i l l i t s e l f look d i r e c t l y at surface Chapter II 32 language, but more freguently i t needs the help of a l e v e l of goals with expertise i n the handling of language. Such goals are grouped into the language l e v e l . This l e v e l of processing involves either taking a surface utterance and interpreting i t as a content description or the opposite process of taking some content description and generating a surface s t r i n g . Multiple sentence utterances or sing l e sentences or clauses or parts of clauses should a l l be handled. The process of i n t e r p r e t a t i o n involves taking an utterance and breaking i t down into groups of words l i k e l y to be related (using b a s i c a l l y syntactic c r i t e r i a ) . Each subgroup i s then interpreted (which i n true top-down parsing fashion may involve s t i l l more breakdowns) into some internal concept representing the meaning of the group (the meaning i s not f i n a l i z e d at t h i s point, but can be further refined as more information about the concept i s gained). These various group meanings must be combined into a single concept representing the meaning of the ent i r e utterance (a process with many case-like aspects). This concept i s then passed back to whatever higher goal wanted to understand the utterance. The generation process has not been studied in d e t a i l , but i t would involve a somewhat diff e r e n t kind of processing wherein a group would be asked to produce surface words that describe some concept. For example, a noun group might produce a surface l e v e l noun group "the brown curly haired animal" to describe the concept "Ruff". Clearly such processing would involve a l l sorts Chapter II 33 of esoteric decisions as to how much to verbalize, what words to choose, etc. These decisions would have to be made using knowledge about the conversant 1s knowledge, information about current goals, and general knowledge about words and word groupings. Many other kinds of processing would be needed to f u l l y explain conversation, such as a good "morpher", a role for bottom-up processing, more analysis of the generation phase, etc. But these four levels do account for most of the issues deemed important e a r l i e r . The combining of world and l i n g u i s t i c knowledge i s e a s i l y done at any l e v e l with the ready mixture of e x t r a - l i n g u i s t i c information with the goals at that l e v e l , and, moreover, the supervising of l i n g u i s t i c goals by non - l i n g u i s t i c goals further contributes to thi s intermixture.. That the desired goaling has been achieved i s obvious from the very organization of the l e v e l s of l i n g u i s t i c analysis. Conversant modelling i s well served with the discovery of the conversants* i d e n t i t i e s by the non-l i n g u i s t i c goals and the use of the information so realized by the l i n g u i s t i c goals. S l i g h t l y l e s s obviously, the desired context considerations are also taken into account by the successive focussing on ever narrower goals with a conseguent narrowing of things needing to be looked into. The goal tree i t s e l f allows access to the current goals of a conversant to any l e v e l . Chapter II 34 2.4 Where to Begin As was argued in the introduction, there are persuasive reasons for studying conversation using a methodology that involves constructing a computer model to take an active role i n a few simple dialogues. Computer modelling enables ideas to be tested, reguires precision in the statement of concepts, provides a powerful process metaphor (along with related computer science concepts), allows a performance model to be b u i l t . Moreover, as section 2.2 has shown, there i s relevant current research which can be used to aid the endeavour. A number of things must be handled when such a computer model i s constructed: (i) The s t a t i c information i n the conversant model and elsewhere must be handled; so must the dynamic goaling a c t i v i t i e s . This information must be stored in ways that allow general rules to be combined with s p e c i f i c information. (ii ) Techniques must be found to access a l l the knowledge i n the model, such as knowledge about conversants, knowledge about subgoaling, knowledge about language, knowledge about the top i c of discussion, etc. ( i i i ) There must be some way of keeping a l l t h i s information in l i n e so that the system i s not overwhelmed by too much at once. The goal tree, as has been pointed out, i s useful i n t h i s capacity, but exactly how i t i s to be represented and used must be determined. (iv) At various l e v e l s i t i s important to record information as to what was said when, who said i t , what the Chapter II 35 context was then, what processing decisions had to be taken, and so on. (v) Naturally, things w i l l go wrong at various times so that, f o r example, when a s c r i p t or speech act has i t s expectations violated, the anomaly must be excused or explained. (vi) There must be a s a t i s f a c t o r y tradeoff between doing a l l t h i s e f f i c i e n t l y and doing i t in a way which i s comprehensible. Mow, i f the introduction i s re-examined, these six requirements w i l l be seen there i n s l i g h t l y disguised terms as the six representation issues of concern to t h i s research. That i s , (i) i s the procedural / declarative controversy; ( i i ) i s the problem of accessing information; ( i i i ) i s the need for context; (iv) i s the necessity for keeping a record of the processing; (y) i s the issue of robustness; and (vi) i s the problem of devising methods which are non-combinatorially explosive yet within the complexity b a r r i e r . Therefore, and i t should come as no great surprise, a prereguisite to t a c k l i n g the problem of modelling conversation i s tackling the problem of representation, at l e a s t to the l e v e l of being able to account for the six phenomena above to some extent. The next couple of chapters w i l l be concerned with doing exactly that. Chapter III outlines a scheme for the representation of knowledge which enhances the chances of achieving (i) - ( v i ) . Chapter IV undertakes a comprehensive analysis of the strengths and weaknesses of t h i s scheme. Chapter I I 36 CHAPTER III A Scheme for Representing Knowledge In t h i s chapter I would l i k e to discuss a scheme f o r representing knowledge that has been developed as a preliminary to exploring the many facets of modelling conversation. I d e a l l y , the scheme should handle procedural and declarative knowledge, be able to access information e a s i l y , have the a b i l i t y to focus on relevant things, keep a memory of events, be robust, and f a l l within complexity and combinatorial boundaries. The representational scheme i s being tested by implementing i t as a set of programs c o l l e c t i v e l y c a l l e d |LISP (because a l l system functions are preceded by a " J " to distinguish them from other functions). System notation i s based as cl o s e l y as possible on LISP, complemented where applicable by CONNIVER (for co-routines and pattern matching). The implementation i s meant to be an extension of LISP in the sense that most of LISP (except for functions noted in section A1.2 of Appendix I) can be invoked d i r e c t l y from within i t . F i n a l l y , i t must be emphasized that the version of JLISP described here has not been coded, although several predecessors have been. Hence, a l l code i s " s o f t " in the sense i t hasn't been run on the computer. The chapter i s organized as follows: section 3.1 contains an overview of the scheme's c a p a b i l i t i e s which, for a l l but the most i n t r e p i d , should provide background s u f f i c i e n t to understand the rest of the thes i s . But, for interested readers, Chapter I I I 37 sections 3,2 through 3.7 describe i n d e t a i l the various features of the scheme: objects, message passing, the matcher, pointers and searching, interrupts, and simulated parallelism. When reading the rest of t h i s chapter (and for that matter the rest of the t h e s i s ) , an important point to remember i s that there are algorithms and detailed descriptions of many system functions in Appendix I. Referring to t h i s Appendix may often help c l e a r up confusion. 3 . 1 Brief Overview The system i s divided into fundamental conceptual units c a l l e d objects which can pass messages to each other and receive responses. A l l messages and responses are co-ordinated by an in t e r p r e t e r (named JEVAL) which reads messages from sending objects, steers them to the proper receiving objects, and l a t e r d irects the responses back to the appropriate sending objects. There are many different types of object in the system, c l a s s i f i e d according to t h e i r message passing behaviour. The simplest are SUBRs which are unanalyzable LISP procedures with no i n t e r n a l structure and employing standard LISP argument conventions. EXPRs are l i k e SDBRs except that t h e i r i n t e r n a l structure i s LISP code. |EXPRs are s i m i l a r to EXPRs, except that their i n t e r n a l structure i s |LISP code and they use stacks l o c a l to objects c a l l e d |PEXPRs for t h e i r argument binding. These types of object are a l l useful for doing e f f i c i e n t , LISP-style processing, but they do not solve many representation Chapter III 38 questions other than e f f i c i e n c y . The objects that are most c r u c i a l to the representation are objects c a l l e d pattern expressions (iPEXPRs) which correspond (roughly) to frames i n that they each represent a single large piece of knowledge in the system. Pattern expressions are meant to be the major domain-dependent objects: most world and l i n g u i s t i c knowledge i s contained i n pattern expressions. (Much procedural knowledge s t i l l remains embedded i n EXPRs or jEXPRs rather than the more analyzable IPEXPRs because a thorough analysis of the semantics of procedures i s beyond the scope of the t h e s i s ) . JPEXPRs are objects whose structure i s a l i s t of (possibly named) patterns. A pattern i s a l i s t whose f i r s t element i s the name of an object, and the rest of whose elements are either the names of objects or further sub-patterns. Moreover, any element of a pattern can be preceded by a single macro character ("?" H i i i « $ « n-n «yr. « # n ngn «/«) which has significance i n i t s matching behaviour. The patterns i n a 1PEXPR are the major component i n defining exactly what that |'PEXPR means (another aspect of a jPEXPR*s meaning comes, of course, from the use of i t s name in the patterns of other IPEXPRs). An example of a fPEXPR i s the HIDGET-PEDDLER pattern expression Chapter I I I 39 {j PDEF WIDGET-PEDDLER 51 : (SUPERSET WIDGET—PEDDLER SELLER) 52 : (SUPERSET WIDGET-PEDDLER PERSON) 53 : (SELL ?/WIDGET-PEDDLER fWIDGET) 54 : (TRADE yWIDGET—PEDDLER f/BDYER 7GOODS I (|COND ( (SOB-INSTANCE-GF GOODS WIDGET) (CREATE-NEW 'MONEY) ) (T (CREATE- NEW 'SERVICES))))) 55 : (CORE WIDGET-PEDDLER (/S3 /S4)) 56 : (INSTANCE WIDGET-PEDDLER PETER) 57 : (INSTANCE WIDGET-PEDDLER MARTHA) ) This |PEXPR i s a s i m p l i f i e d version of the model's e x p l i c i t knowledge about widget peddlers. I t i n i t s e l f does not have any " r e a l world" reference; that i s WIDGET-PEDDLER i s not any pa r t i c u l a r widget peddler or group of peddlers, but i s rather a description of the c h a r a c t e r i s t i c s that widget peddlers have i n common. I t can be interpreted as follows: (i) the name of the (PEXPR i s WIDGET-PEDDLER; (ii) the body of the j PEXPR i s the c o l l e c t i o n of patterns S1 through S7; ( i i i ) each pattern i n the body i s labelled with a pattern name S i ; (iv) pattern S1 says that the | PEXPR WIDGET-PEDDLER has superset SELLER; (v) pattern S2 says that the | PEXPR WIDGET-PEDDLER has another superset, PERSON; (vi) pattern S3 says that an arbitrary instance of WIDGET-PEDDLER s e l l s an ar b i t r a r y instance of WIDGETs; (vii) pattern S4 says that an arbit r a r y instance of WIDGET-PEDDLER trades with an arbit r a r y instance of Chapter I I I 40 BUY EE as follows: the widget peddler exchanges "goods" for either money or services depending on whether the goods are widgets. ( v i i i ) pattern S5 says that patterns S3 and S4 are the core patterns of the |PEXPR; that i s , they are more central to i t s meaning than are other patterns (this i s useful mainly in comparing |P EX Pits to one another where core patterns are the central patterns which must be compared); (ix) patterns S6 and S7 define a couple of instances of the widget peddler, namely PETER and MARTHA* The other component of any jPEXPR i s how i t handles messages sent to i t from other objects in the system. Another object, say the |PEXPR BUY-WIDGET, might formulate the message (MIDGET-PEDDLER (TRADE PETER SELF SQUIGGLY-WIDGET ?WHAT-C0ST) (ATTITUDE PETER ?WHAT-ATTITUDE) ) That i s , BUY-WIDGET i s interested i n seeing what (according to WIDGET-PEDDLER) SELF might give to PETER in return for the SQUIGGLY-WIDGET; and also to see what attitude PETER should be expected to maintain. Here i s a s i m p l i f i e d outline of what happens to the message: (i) The message i s read by the interpreter as i t i s executing code within a pattern of the BUY-WIDGET expression. The interpreter (named JEVAL i n the implementation) acts as a central switchboard whose Chapter III 41 task i t i s to buffer contact between objects. Whenever an object formulates a message, i t i s read by the interpreter and dispatched to the appropriate receiving object where i t i s further processed. If this object should desire to send any messages of i t s own, i t too must route them through |EVAL. Shen an object i s finished answering a message, i t n o t i f i e s the interpreter which passes back the response and resumes execution of the object which sent the message. (i i ) So, in t h i s case the interpreter sees that the receiving object i s to be a JPEXPR named WIDGET-PEDDLER. ( i i i ) Setting aside for the moment the rather complex set of things that happens next, the eventual e f f e c t of the message i s that the message pattern (TRADE PETER SELF SQUIGGLY-WIDGET ?WHAT-COST) i s matched against patterns in the body of WIDGET-PEDDLER. (iv) the pattern l a b e l l e d "S4" i s discovered and i s found to match under the assumption that PETER i s a par t i c u l a r WIDGET—PEDDLER (a fact discoverable by looking at the ]PEXPR to see i f i t has a pattern (INSTANCE—OF PETER WIDGET-PEDDLER) and SELF i s a par t i c u l a r BUYER. I f the further assumption i s made that SQUIGGLY-WIDGET i s a p a r t i c u l a r WIDGET, then the pattern's l a s t element w i l l be MONEY 1, a JPEXPR Chapter I I I 42 representing an i n d i v i d u a l price appropriate to the widget. Thus, the pattern to be returned i n answer to the TRADE message i s (TRADE PETER SELF SQUIGGLY-WIDGET M0NEY1) . This pattern i s saved for return to BUY-WIDGET, (v) But, f i r s t , the message pattern (ATTITUDE PETER ?WHAT-ATTITUDE) must also be matched i n WIDGET-PEDDLER. No match i s found, so after a further set of rather elaborate machinations which I w i l l go i n t o i n a l i t t l e while, the "ISA environment" "above" WIDGET-PEDDLER i s looked into. , fvi) The only "ISA" (PEXPRs are SELLER and PERSON, so they are searched i n breadth-first fashion (although in t h i s case there i s n ' t much breadth for long since the superset of SELLER i s i t s e l f PERSON) f o r a pattern matching (ATTITUDE PETER 7WHAT-ATTITUDE) . (vii) If the knowledge of s e l l e r s i s complete, i t w i l l be discovered that the attitude of any part i c u l a r s e l l e r i s that of politeness, so (ATTITUDE PETER POLITE) w i l l be the appropriate matching pattern for the message.. This pattern w i l l be inherited by WIDGET-PEDDLER and w i l l be saved f o r return to BUY-WIDGET. ( v i i i ) Since there are no more patterns i n the message, the two response patterns (TRADE PETER SELF SQUIGGLY-WIDGET M0NEY1) and (ATTITUDE PETER POLITE) are appended and returned to Chapter III 43 BUY-WIDGET where they can be used. This, then, has been a general look at some of the features of the representation scheme. I would now l i k e to discuss these features i n more d e t a i l . 3~.2 The Objects 3.2.! Pattern Expressions A pattern expression i s defined as an atom with a property i i s t indicator JPEXPR designating i t s body. The body i s a l i s t of patterns, where a pattern i s , i n turn, a l i s t of elements, the f i r s t element of which i s an object name and the rest of whose elements can be object names, sub-patterns, or single-character macros. A macro indicates that the following element i s to be treated i n a s p e c i a l way by the pattern matcher, thus giving the a b i l i t y to postpone decisions u n t i l the information in the pattern i s actually needed. In p a r t i c u l a r there are macros which allow computations to be c a r r i e d out, to allow matching of any element, to allow expansion to larger elements, and others. Macros w i l l be more f u l l y explained i n the section on pattern matching. Patterns can also be la b e l l e d so that other patterns can refer to them. This i s done by preceding a pattern with a name, followed by a ":,»; f o r example, S 1 : (SUPERSET WIDGET-PEDDLER SELLER) lab e l s the pattern (SUPERSET WIDGET—PEDDLER SELLER) with the Chapter III 44 name S1. These labels are l o c a l to the pattern expression (so that other pattern expressions can use the same name without confusion). F i n a l l y , only a top-level pattern can be l a b e l l e d , i . e . labels cannot appear inside patterns. 3.2.2 Other Objects There are three kinds of object besides |PEXPRs: primitives, EXPRs, and |EXPRs., Primitives are atoms with no i n t e r n a l structure, just names. Such objects are primitive i n the sense they cannot be further analyzed; but, unlike Schank*s (e.g. see Schank (1975)) primitive acts, much information could be added to an object i f some future analysis made i t necessary to have a more elaborate conception of the object. Morevoer, i n many situations, even well endowed objects need be considered only i n terms of t h e i r names, not their contents, hence making them e f f e c t i v e l y primitive at that time. The idea that any object can be considered primitive or not, as desired, i s fundamental to the system and i s i n di r e c t c o n f l i c t with Schank's hypothesis (this i s not to say that i t i s n ' t often useful to consider a conveniently small set of primitives f o r any one context). EXPRs are objects whose structure i s stored under the indicator EXPR on the property l i s t of the object name. This body of the EXPR i s a LISP LAMBDA, NLAMBDA, OR FLAMBDA expression. |EXPRs are the same as EXPRs except the property l i s t i n d i c a t o r i s JEXPR and the body i s a |LAMBDA, JNLAMBD&, or Chapter III 45 jFLAMBDA expression., These }LAMBDA expressions have a s l i g h t l y d i f f e r e n t way of binding t h e i r arguments (using the current iPEXPE stack, something that w i l l be explained s h o r t l y ) . 3.3 Details of Message Passing 3 . 3. J. Introduction There are many occasions when an object must communicate with another object: when i t needs a piece of knowledge that i t doesn't know d i r e c t l y , when i t has information that would be of use to another object, when i t wants to achieve a subgoal, when i t wants to associatively s i g n a l a "neighbouring" object; and so on. A l l of these various kinds of communication are accomplished by passing messages from one object to another and receiving corresponding responses. To be able to send a message to object B, object A must know B»s name. This i s not guite as much of a r e s t r i c t i o n as i t might seem, since many computations can be carried out, i f necessary, before discovering the name. Once i t has the name, A must then compose the message i n the format which B expects (be i t a l i s t of arguments, a l i s t of patterns, or whatever).. The message i s then appended to the receiving o b j e c t 1 s name {B "message") and the entire message form i s sent off to the interpreter 1 EVAL. The basic logic for JEVAL i s given in Appendix I, but Chapter I I I 46 perhaps a brief description of i t s behaviour would be i n order here. assume that |EVAL has received a message form of some sort. The message can either be (i) an atom or | i i ) a l i s t . (i) I f the message form i s an atom, JEVAL r e a l i z e s that no message i s being sent to any other object; instead the value of the atom i s desired. Atom-value pairs are stored within pattern expressions on a stack which i s just a pattern of the form {|STACK object-name (stack-values)) whose t h i r d element contains the atom-value pairs. To understand exactly which stack i s to be searched for the value of an atom, i t i s necessary to r e a l i z e that i n some sense a l l processing i s done within pattern expressions. Thus, the system i s i n i t i a l i z e d with a top-level READ—|EVAL—PRINT pattern expression in control (see TOP-VIEW in Chapter V) and a l l t o p - l e v e l c a l l s are in some sense embedded within t h i s |PEXPR. Whenever a message i s sent to some other (PEXPR, the new JPEXPR becomes the pattern expression i n which subsequent processing takes place. I t either f i n i s h e s (in which case a previously i n i t i a l i z e d j PEXPR i s resumed, probably the one to which the response has been sent) or i t c a l l s i n s t i l l another 1PEXPR to take control. In any case there i s always unambiguously one pattern expression i n control: i t i s c a l l e d the current- |PEXPR and a l l stack operations are performed on i t s stack. Thus, i n the si t u a t i o n where the message form i s merely an atom, the interpreter finds i t s value on the current stack and returns i t as the response to the message (or NIL i f no value i s found). Chapter I I I U7 (ii) I f the message form i s a l i s t with message head either an atom or a lambda expression of some sort, then t h i s i s a message to be further processed. If the message head i s (a) the SUBB QUOTE; the message i s returned unchanged. (b) a |PEXPR; then s p e c i a l processing takes place which I ' l l explain shortly. (c) a JEXPR; then associated with the object i s a |LAMBDA expression which accepts the message as actual parameters to be bound to i t s formal parameters on the current stack* The binding i s done (perhaps requiring the JEVALuation of the actual parameters depending on whether the body i s a JLAMBDA, jNLAMBDA or | FLAMBDA) , the object's | L AM BD A body i s then J EVALed. Eventually, the |LAMBDA body i s done, so the bindings are popped, and the r e s u l t of the |LAMBDA JEVALuation i s returned i n response. (d) an EXPR; then associated with the object i s a LISP LAMBDA expression accepting the message as actual parameters to be bound to i t s formal parameters on the LISP stack. The binding i s done, reguiring f i r s t the EVALuation of the actual parameters i f the LAMBDA i s a LAMBDA (but i f i t i s a NLAMBDA or FLAMBDA, i t i s assumed that the programmer has indicated e x p l i c i t l y when to EVAL in the body of the function). The EXPR i s then EVALed, and the value returned i s the response to the message. <e) a SUBR; then the object i s APPLYed to J EVAL of each element of the rest of the message form. (f) a NSUBR or FSUBfl; then an error i s generated since Chapter I I I 48 such objects cannot |EVAL the message elements properly. (g) a J LAMBDA-expression or LAMBDA-expression; then the obvious binding, popping, and EVALing takes place on the PEXPR stack and LISP stack respectively, just as in the corresponding EXPR or |EXPR case. (h) any other form; w i l l r e s u l t i n f a i l u r e . 3.3.2 Messages to IPEXPRs So, we now return to |PEXPR message handling, both the most important and also the most complex kind currently extant. I f the function descriptions of Appendix I are studied the d e t a i l s of what i s going on w i l l become more apparent. Perhaps, the aest way of elucidating the process here i s to do a step by step analysis of what would happen to one communication sent from A1 to B. Say the message form (B (x y z) {r s t u)) i s |EVALed within A1., The interpreter reads the message form, sees the object B (the message head) i s a pattern expression (by discovering the a t t r i b u t e |PEXPR on B's property l i s t ) . I t creates a new, i n i t i a l l y empty pa?ttern expression to serve as a working-storage area for B as i t answers the message. The new jPEXPR i s given an i n t e r n a l name (B1, say) and i s call e d an execution instance of B. Next, three patterns are asserted i n B1: (EX-INSTANCE-OF BI fl) (EX-ENVIBON B1 A1) (|STACK B1 NIL) Chapter I I I 49 EX-INSTANCE-OF "points" to B r the object which has been sent the message; via t h i s pointer a l l of the "ISA" environment can be accessed (where the ISA environment consists of a l l those j PEXPRs that can be reached by going along EX-INSTANCE-OF, INSTANCE-OF, or SUPERSET pointers). EX-ENVIRON "points" to the sending J PEXPR A1 in the execution environment or dynamic context of B1. F i n a l l y | STACK indicates the l o c a l pattern expression stack, i n i t i a l l y empty. Next, the stack must be i n i t i a l i z e d with a form calle d the message handler. This form can then be EVALed and w i l l d i r e c t the pattern expression i n i t s hunt for an appropriate response. In t h i s case, a form (IPEXPR-MH (B (x y z) (r s t u) ) ) w i l l be pushed onto the stack of B1 as the value of the special atom |EV. Such an atom / value pair i s c a l l e d a "J EVAL block". Whenever the interpreter decides to actually execute a JPEXPR, i t merely looks for the top JEVAL block on the stack of that jPEXPR and executes the form i t finds there. In t h i s case, then, the c a l l to the message handler JPEXPR-HH can be discovered and jEVALed to carry on the processing of the message. It would seem reasonable to make B1 the current pattern expression and do exactly t h i s , thus e f f e c t i v e l y transferring control. But, t h i s i s not what happens: B1 i s merely scheduled to run by merging i t i n t o an execute gueue along with a p r i o r i t y i n d i c a t i n g i t s potential importance to the system. This p r i o r i t y defaults to 5 (on a scale of 0 to 9) i f i t i s n ' t Chapter III 50 e x p l i c i t l y given in the message {that i s , a message can contain patterns which are e s s e n t i a l l y instructions to the interpreter rather than actual patterns to be handled by B1). One of these i s (JPRIO= p r i o r i t y ) where p r i o r i t y i s some integer between 0 and 9, (Other such messages w i l l be seen i n a l a t e r section). The interpreter checks f o r a l l such patterns, s t r i p s them from the message, and acts upon them. For (|PRI0= p r i o r i t y ) , the action i s to assert i n B1 the p r i o r i t y (PRIORITY B1 p r i o r i t y ) , in th i s case, by default, (PRIORITY B1 5). The scheduler i s then summoned (actually returned t o ) . After having "aged" the execute queue p r i o r i t i e s (by increasing a l l p r i o r i t i e s by some fixed amount so that eventually a l l objects w i l l get to run), i t c a l l s upon the pattern expression with the highest p r i o r i t y to be made current and executed. By executing a |PEXPR, I mean JEVALing the top |EVAL block on i t s stack. So, i n due course B1 i s c a l l e d i n , made the current pattern expression, and the top form (IPEXPR-MH (B {x y z) (r s t u))) i s JEVALed. |PEXPR-MH, the EXPR which handles most pattern expression messages i s given i n Appendix I. I t matches each message pattern ( i . e . (x y z) , (r s t u)) against receiving patterns in the body of B. At the present time, the patterns of B are scanned from newest pattern to oldest (where the sequencing of patterns within a J PEXPR can be determined by Chapter III 51 looking at th e i r p o sition i n the l i s t of patterns that constitute the body of the |PEXPR). I t would be much better, i n the long run, i f JPEXPR-MH used an indexing scheme to access the patterns of a |PEXPR body, but the JPEXPRs considered so f a r are small enough to obviate the immediate need for such a feature., If patterns matching the message patterns are found, they are put in an answer l i s t and returned by )PEXPR-MH as the answer to the message. |PEXPR-MH also asserts each matching pattern in the body of Bl so that they can be l a t e r accessed i f desired. lPEXPR-MH sends the answer l i s t back to A 1 , and also asserts i n the body of A l , a return condition of the following form: (RETURN-COND ex-environ-ob return-type return-codes return-value) where return-type i s {usually) NORMAL, return-codes i s a l i s t of sub-|PEXPRs of importance to answering the message (usually the receiving object), and return-value i s the answer l i s t of matching patterns. In t h i s example, (RETURN-COND A1 NORMAL (B1) {{x» y» Z ' ) { r ' s' t» u 1))) might be asserted in A1. This return condition i s b a s i c a l l y unimportant for the NORMAL return, but for other more esoteric returns, return-codes become c r u c i a l . The guestion a r i s e s : what would have happened i f JPEXPR-MH had been unable to discover a match in B for some message pattern, say (x y z)? In cases such as t h i s , the matcher does not give up. Instead, i t looks at the f i r s t element of the pattern to be matched ( i . e . x, here) and seeks i t s aid i n find i n g a match. The rationale for consulting x i s that the Chapter III 52 f i r s t element of a pattern usually acts as the r e l a t i o n connecting a l l the other elements, and i s thus the most c r u c i a l part of the pattern. The hope i s that x w i l l have associated with i t a f a i l u r e to match pattern that t e l l s the matcher what to do i f at any time an x pattern i s unmatched. There are various p o s s i b i l i t i e s : look into the ISA environment of B1; look into the execution environment of B1; perform some sort of inference; give up; and so on. The various p o s s i b i l i t i e s for search w i l l be elucidated in Chapter VI after some f a m i l i a r i t y has been gained with the system. For the sake of i l l u s t r a t i o n , assume that x has the pattern (1) (FAILURE-TO-HATCH X '?PATTERN ?OBJECT ! ( S E A R C H - I S ! PATTERN OBJECT))) i n i t s body; that i s , i f PATTERN has f a i l e d to match i n OBJECT, d i r e c t a search (using the EXPR SEARCH—ISA) for PATTERN into the ISA environment of object. What SEARCH-ISA does i s to search up EX-INSTANCE-OF, INSTANCE-OF, and SUPERSET l i n k s , b r e a d t h - f i r s t , matching patterns against patterns i n the body of each |PEXPR encountered u n t i l eventually the pattern i s matched and the matching pattern returned, or u n t i l no ISA l i n k s remain to be traversed in which case the f i r s t message (x y z) cannot be answered. This eventuality would resu l t in NIL being appended to the answer-list. In the present circumstances, the matcher has f a i l e d to f i n d a match for (x y z) in B1, so i t formulates a pattern (2) (FAILURE-TO-MATCH x (x y z) B1 ?MATCHING-PAT) which i t matches against patterns i n the body of x, finding (1) above thus e f f e c t i n g an ISA search from B1. Eventually, Chapter III 53 HATCHING-PAT w i l l be bound to a pattern matching (x y z) or NIL and this value w i l l be returned as the response to the (x y z) message pattern. A f i n a l point: i f x did not contain any FAILURE-TO-MATCH pattern, then the matcher would know automatically not to undertake f a i l u r e processing (thus avoiding an i n f i n i t e regress of attempted matches). Failure to match . processing means that guite robust behaviour can be achieved. A system can be designed so that i t can, when temporarily stymied, make use of knowledge appropriate to the current context and the kind of data which i s causing the trouble rather than r e l y i n g on some more uniform mechanisms. Being able to use l o c a l knowledge such as t h i s i s one of the strong points of the representation. Meanwhile, once i t has fi n i s h e d answering the message, IPEXPfi-MH reschedules the sending pattern expression (discovered by looking up the EX-ENVIRON pointer), which i s A1 i n t h i s case. The p r i o r i t y of A1 on the execute gueue i s set to i t s o r i g i n a l (stored) value, even i f A1 at some time had been given a larger gueue p r i o r i t y as a r e s u l t of the scheduler's aging technique. Eventually, A1 i s re-started where i t l e f t off with the value of the message being r e a d i l y available. Thus, i f ( (x y z) (r s t u)) had been embedded in a c a l l to the jEXPR RALPH; e.g. (RALPH (B (x y z) (r s t u)) ) then RALPH would have access to the value of the message, i . e . RALPH would execute with argument ((x» y» z») (r» s* t« u»)) . Chapter III 54 RALPH could, of course, f i n d out the new execution instance created i n answering the message, the return type, and so on, by looking at the RETURN—COND pattern. One f i n a l note here: B1 has not disappeared (although i t s stack has been f u l l y popped of |EVAL blocks). Execution instances stay around so they can be queried (perhaps) l a t e r as to various pieces of information i n them such as the matching answer patterns, the execution environment or execution instance pointers, etc. This i s important i n many places, especially i n looking at old execution environments to see the concerns of that time. Eventually, of course, some sort of garbage c o l l e c t i o n must take place. Moreover, given the potential importance of some execution instances, i t seems c r u c i a l to do such c o l l e c t i o n i n t e l l i g e n t l y . Such an i n t e l l i g e n t garbage c o l l e c t o r has not been worked out i n any d e t a i l , although what i t would need to do i s discussed somewhat more f u l l y l a t e r i n the thesis. 3.4 The Matcher 3*4.1. The D e f i n i t i o n of the Pattern Matching Macros Throughout the exposition of the representation scheme, the concept of pattern matching has cropped up with alarming r e g u l a r i t y . The most ubiquitous use of pattern matching i s by the system i t s e l f when i t handles pattern expression message passing. But the pattern matcher can be used elsewhere, by Chapter I I I 55 other system programs or by the user. Because of t h i s , more general terminology than "message pattern", "receiving pattern", "sending object", and "receiving object" i s needed to describe the patterns being compared. So, I w i l l speak of <i) the source pattern. the pattern for which a match i s being sought, corresponding i n the message case to the message pattern; (ii ) the target pattern, the pattern which i s a candidate as a possible match fo r the source, corresponding in the message case to the receiving pattern; ( i i i ) the source object, the pattern expression which i s to serve as the context for any macro operations i n source pattern, the sending object i n the message case; (iv) the target object, the pattern expression which i s to serve as the context for any macro operations i n the candidate pattern, the receiving object in the message case. Whenever a source pattern i s matched against a target pattern, the source object and target object must be s p e c i f i e d as well. The basic p r i n c i p l e underlying pattern matching can be summed up by the fundamental matching rul e : A source pattern matches a target pattern i f each element of the source matches the corresponding element of the target, unless one of the elements i s ML, in which case the patterns f a i l to match. If a source element designates an object, then i t matches Chapter I I I 56 the corresponding target element only i f they designate the same object. If a source element i s a sub-pattern, then i t matches the corresponding target element only i f the sub-patterns match. Onder the fundamental matching rule, the following source / target pairs w i l l match: (i) (A B C D) : (A B C D) ( i i ) (A (B C) D) : (A (B C) D) ( i i i ) (({A {((B C)) D)))):(((A {((B C)) D)))) but, the following w i l l not match: (i) (A B C D) : (A (B C) D) ( i i ) (A (B) (C) D) : (A <B) (C D) ) ( i i i ) (A (B (C (D)))):(A (B (C (D NIL)))) Pattern matching would be a t r i v i a l exercise indeed i f t h i s were a l l there was to i t . But, lurking i n the shadows are pattern matching macros which are sp e c i a l characters (not objects) that have meaning to the matcher and certain other system functions. A macro character can precede any element i n a pattern (including a sub-pattern). No more than one macro character per element i s allowed, however. A macro character indicates to the matcher that the element i s to be treated d i f f e r e n t l y during matching. There are macros that t e l l the matcher to |EVAL the element before matching, or to consider that the element matches anything, or to match only elements which pass certain tests, or any of a number of other things. Chapter III 57 Macros are s i m i l a r to Hewitt*s (1972) o r i g i n a l idea of actors. In the following description of the macros, i t should be kept i n mind that their operation i s t o t a l l y symmetric. The macros are often described as i f they appear before an element i n a target pattern, but t h e i r action i f they appear before a source pattern element would be exactly analogous. (i) w!" This macro i s an i n s t r u c t i o n to the matcher to |EVAL the following element before attempting to match i t (because the matcher works i n inverse QUOTE mode, JEVALuation must be e x p l i c i t l y indicated). If a stack i s needed, the stack corresponding to the pattern containing the element i s used. For example (INSTANCE—OF GEORGE-III KING) w i l l match (INSTANCE-OF IKING KING) i f and only i f KING has value GEORGE-III on the stack of the target object. Another example: (EXECUTE GOTO QET) w i l l match (EXECUTE GOTO !(|COND ( (EQ CONCERT 'SYMPHONY) ' QET) (T 'COLISEUM))) i f and only i f the JCOND |EVALs to QET. Note that the target stack must be used to find the value of CONCERT. It i s through the use of "!" macros that a pattern expression obtains procedural a b i l i t y ; that i s , often a rather long computation must be c a r r i e d out before trying to match an element, a computation which could involve sending messages to other pattern expressions, etc., In the message passing example (section 3.3.1) the message to B could have been embedded i n some sort of pattern in Al's body, i . e . (EXECUTE FOIBLES ! (RALPH (B (X y z) (r S t u) ) ) ) Chapter III 58 which was being matched in an attempt to answer a message sent to A1 by some other pattern expression. Before the third element could be matched, the "!" forces a JEVAL of the "RALPH" expression, thus setting off the chain of events described e a r l i e r . A f i n a l note: "!" can often be used outside of patterns to indicate |EVAL where normally no such IEVAL could take place. In p a r t i c u l a r i t can be used i n the arguments of jASSERT (see below) and i n front of the message head in a message form (indicating that a message i s to be sent to the value of a name rather than to the name i t s e l f ) . (ii) "$" This i s almost exactly the same as "!" except that i t says to the matcher to EVAL the element, rather than to j EVAL i t . This aids e f f i c i e n c y i f the user knows that a certain form can be executed i n LISP., The d i f f i c u l t y , of course, l i e s i n the fact that no |EXPRs or JPEXPRs can be handled nor can any 1PEXPR l e v e l variables, so caution i s needed when using "$". A common use for "$" i s when some EXPR must be executed with constant arguments, e.g. when matching (COMPUTE FACTORIAL-5 $ (FACT 5)), the already defined LISP function FACT can be c a l l e d i n since i t uses no J LISP features. ( i i i ) "/" This macro character assumes that the following element i s the l a b e l of a pattern i n the body of the target element. "/" Merely says to replace the l a b e l by the pattern i t s e l f during matching. Thus, the source (CHASE (BROWN DOG) HELICOPTER) w i l l match the target (CHASE /S7 HELICOPTER) only i f S7 l a b e l s the pattern (BROWN DOG) Chapter I I I 59 i n the target object. {iv) "?" The processing for th i s macro character i s s l i g h t l y more complex than for the macros seen so f a r . "?" indicates that the target element i s to match anything, but with the side-effect that the element i s bound to the matching element on the target stack. Note that the target element must be an object rather than a sub-pattern. For example the target pattern {SLOGAN IOMENS-YEAR (?WHAT)) w i l l match the source (SLOGAN WOMENS—YEAR ( (WHY NOT) ) with WHAT being bound to (WHY NOT) on the source stack. (v) "#" Every so often i t i s desirable to suppress macro processing in the corresponding element of the other pattern so that the f u l l blown macro code can be looked at.. "#" i s designed to do t h i s . I t acts l i k e in that i t w i l l match anything and bind i t s element to the matching element; however, i t f i r s t turns o f f macro processing on the other side (except i f the element has a macro that i s i t s e l f # - see below). This i s useful for getting "code" unevaluated so that i t can be examined. Thus, the target (EXECUTE PARSER #PARSE-CODE) would match the source (EXECUTE PARSER !{JPROG{) )) with PARSE—CODE Deing bound to !(|PROG{) ) in the source. (vi) "=" This i s a macro character that i s r e s t r i c t e d i n the kind of element which can follow i t . "=" must precede an element of the kind "(object-name message-form)", where object i s any object i n the system and message-form i s any form which can be |EVALed. Thus, the f u l l macro-element pair i s "=(object-name message-form)". Chapter III 6 0 Assume "=" i s i n the target pattern* It t e l l s the matcher 1 . temporarily bind object-name (on the target stack) to the corresponding source pattern element; 2. | EVAL message-f orm ; 3. i f message-form doesn't return NIL, then the binding i s kept and the elements match; 4., else, i f message-form returns NIL, then the binding i s discarded and the elements f a i l to match. This feature allows a "condition" to be imposed on the kinds of elements that w i l l match, a condition that can be a r b i t r a r i l y complex. For example, the pattern (SELLS =(INDIVIDUAL (SUB-INSTANCE INDIVIDUAL SELLER)) TICKET-TO-CONCERT) w i l l only match patterns whose f i r s t and t h i r d elements are SELLS and TICKET-TO-CONCERT and whose second element i s some in d i v i d u a l who i s a SELLER. SOB-INSTANCE i s an EXPR which returns T i f i t s f i r s t argument names a jPEXPR that i s an instance (or execution instance) of the IPEXPR specified i n the second argument; else SUB-INSTANCE returns NIL. If JOHN i s such an i n d i v i d u a l , then the source pattern (SELLS JOHN TICKETS-TO-CONCERT) would match the target above with INDIVIDUAL being bound to JOHN on the target stack. (vii) " t " Without loss of generality assume that " t " precedes a target element. Then " f " informs the matcher that the source element must be a SUB-INSTANCE (as just defined) of the target element. Thus, f/SELLER w i l l match only instances (or execution instances) of SELLER or instances (or execution Chapter III 61 instances) of subsets of SELLER. The matching SUB-INSTANCE i s assigned as value of SELLER. F i n a l l y , note that fX matched against ?Y w i l l r e s u l t i n the creation of a new instance of X to be assigned to Y (see macro c o n f l i c t table. Figure 3.1). ( v i i i ) "0" This macro character precedes an atomic target element and binds i t to the corresponding source element just as long as that source element i f the name of the source object. Thus, the target (BEATS f*ME) matches the source {BEATS YOU) i f YOU i s the source object. This i s useful mainly i n accessing data from i n t e r n a l l y named |PEXPBs or yet to be named |PEXPRs (such as new execution instances). This set of macros i s a preliminary set which has been found to be useful i n the examples I have considered. Many more could no doubt be contrived. Although they cannot be nested, they can be used together in the same pattern provided they are attached to separate elements. And when such features are used many standard programming language features can be simulated. 11 ?" allows parameter passing and the binding of arguments; "!" gives a procedural c a p a b i l i t y and when a »!" i s opposite a "?" then a c a l l - b y - r e s u l t i s evident. For example, the source (FHUMP X !Y 7ANSWER) matches the target (FWUMP ?PARAM 1 PARAM2 ! (CONS PARAMI PARAM2)} with PARAM1 being bound in the target object to X; PARAM2 being bound i n the target object to the value (in the source object) of Y (say VAL-Y) (e f f e c t i v e l y c a l l by value); and ANSWER being bound to Chapter I I I 62 the r e s u l t of CONSing PARAM1 TO PARAM2, e. g* (X . VAL-Y) (i.e. a procedure in the target object and a c a l l by result i n the source). This kind of program simulation i s used rather a l o t i n the examples of Chapter V which naturally brings up the question of what exactly are the advantages of using pattern matching rather than direct function c a l l s ? There i s , f i r s t of a l l , the a b i l i t y to match non-procedural patterns and the a b i l i t y to use procedural information (such as "f/", "!", «=», etc.) neither of which are normal function c a l l i n g a b i l i t i e s . Moreover, there i s the fact that pattern matching i s very much l e s s d e f i n i t i v e about what are arguments, values, procedures, etc. In one case 7PABAM1 might act as a c a l l by value, i n another case something els e , depending on i t s corresponding element. Another difference i s that the use of pattern matching i n message passing between JPEXPRs allows multiple procedures to be attached to the same object i n the sense that more than one pattern could match (potentially), and the sender has no way of knowing which one w i l l . F i n a l l y , f a i l u r e to match techniques associated with the matcher go well beyond the scope of most programming languages. In sum, then, matching has been designed to be more general than the usual procedure c a l l i n g mechanisms. I t ' s just a useful a r t i f a c t of the paradigm that a subset of the matching c a p a b i l i t i e s coincides with some of the standard programming language features. Chapter I I I 63 3_-1-2 D i f f i c u l t i e s with Macros Throughout the discussion of macros, an unstated problem has existed: what to do i f an element i n the source pattern i s preceded by a macro character at the same time as the corresponding element in the target pattern. Most of the time the resolution of the c o n f l i c t i s just common sense, as w i l l be seen i f the macro c o n f l i c t table. Figure 3.1, i s studied c l o s e l y . The occasional d i f f i c u l t i e s are explained there as well. Note that the table i s symmetric with respect to source and target elements. ISO -ITA - |EVAL SO; JEVAL TA; i f egual, match succeeds. $TA - |EVAL SO; EVAL TA; i f egual, match succeeds. /T A - |EVAL SO; expand TA; i f egual, match succeeds. ?TA - JEVAL SO; TA <— r e s u l t ; match succeeds. #TA - TA <— ISO (un}EVALed); match succeeds. =iTA cond-TA) - |EVAL SO; TA <— re s u l t ; |EVAL cond-TA; i f non-NIL, succeed; else unbind and f a i l . 1TA - |EVAL SO; i f result i s a subinstance of TA, TA <— resu l t and succeed; else f a i l . £TA - |EVAL SO; TA <— source object; i f egual, match succeeds; else f a i l . $TA - EVAL SO; EVAL TA; i f egual, match succeeds. ^TA - EVAL SO; expand TA; i f egual, match succeeds. ?TA - EVAL SO; TA < — r e s u l t ; match succeeds. #TA - TA < — $S0 (unEVALed); match succeeds., =iTA cond-TA) - EVAL SO; TA <— r e s u l t ; J EVAL cond-TA; i f non-NIL, succeed; else unbind and f a i l . ±Th - EVAL SO; i f resu l t i s a subinstance of TA, TA <— resu l t and succeed; else f a i l . £TA - EVAL SO; TA <-- source object; i f egual, succeed; else f a i l . Chapter I I I 64 /so -/TA - expand SO; expand TA; i f equal, match succeeds. ?TA - expand SO; TA <— r e s u l t ; match succeeds. #T A - TA <— /SO (unexpanded); match succeeds, fill cond-TA) - expand SO; TA <— r e s u l t ; j EVAL cond-TA; i f non-NIL, succeed; else unbind and f a i l . JrTA - match f a i l s (pattern can* t be subinstance of object)., 2TA - match f a i l s (pattern can't be source object). ?S0 -?TA - SO <— |0N; TA <— |UN; match succeeds. #TA - SO <— |ON; TA <— ?S0; match succeeds. =_£TA cond^TAJL - SO <— |0N; TA <— JON; JEVAL cond-TA; i f non-NIL, succeed; else unbind and f a i l . JfTA - TA <-- SO <— a new instance of TA; match succeeds. £T A - SO <— TA <— source object; match succeeds. I S O -#TA - SO <-- #T A; TA <-- #SO; match succeeds. =ITA cond^TAl - SO <— =(TA cond-TA); TA <— J ON; match succeeds. JTA - SO <— fTA; match succeeds. £TA - SO <-- £TA; TA <— I ON; match succeeds. =1S0 cond-SO) -= (TA cond-TA}_ - TA <— SO <— | UN; i f both I EVAL of cond-SO and |EVAL of cond-TA are non-NIL, then succeed; else f a i l . jrTA - TA <— SO <— a new instance of TA; JEVAL cond-SO; i f non-NIL succeed; else unbind and f a i l . £TA - SO < — TA <— source object; JEVAL cond-SO; i f non-NIL succeed; else unbind and f a i l . I S O -J[TA - match succeeds i f TA i s a subset of SO or SO i s a subset of TA; a new instance of the lowest one i s created and bound to both TA and SO. £TA - SO <— TA <— source object; i f source object i s a subinstance of the object SO, succeed; else unbind and f a i l . £S0 -£TA - TA <— source object; SO <— target object; i f they are the same, succeed; else unbind and f a i l . Chapter III 65 Legend SO i s the source element (contained i n source pattern). TA i s the target element (contained i n target pattern). X <— Y means assign X to Y (undone i f match f a i l s ) . |UN i s a s p e c i a l NIL-like atom that means "unassigned". Figure 3._1 - Macro C o n f l i c t Table I t should be noted that there can be situations when there are incompatible le v e l s , s p e c i f i c a l l y (i) ?SO i s matched against (TA 1 TA2 ... TAn); ( i i ) #S0 i s matched against (TA1 TA2 ... TAn); ( i i i ) = (SO cond-SO) i s matched against (TA 1 TA2 ... TAn). In these cases the source element i s uniguely r e p l i c a t e d n times so that we try matching (?S01 ?S02 ... ?SOn) against <TA1 TA2 ... TAn); (#S01 #S02 ...,#SOn) against (TA1 TA2 ... TAn); (={S01 cond-S01) =(S02 cond-S02) = (SOn cond-SOn) ) against (TA 1 TA2 ... TAn). Then the source macro i t s e l f i s matched against the l i s t (S01 S02 ... SOn) formed as a r e s u l t of the matching; that i s , ?S0 against (SG1 S02 ... SOn); #S0 against (S01 S02 SOn); =(SO cond-SO) against (S01 S02 ... SOn). Any other multilevel ambiguities are handled by the rules for pattern matching or the macro c o n f l i c t table r e s t r i c t i o n s . A more serious conceptual problem involving macros can a r i s e because of the current l e f t - t o - r i g h t matching of message pattern elements against receiving pattern elements. Assume Chapter I I I 66 there i s a macro w i t h i n a patt e r n that i s a c a l l t o a computation f u l l of messages to other JPEXPBs and other s i d e - e f f e c t s . Assume f u r t h e r t h a t the p a t t e r n macro i s executed d u r i n g a pattern match, does i t s t h i n g , and r e t u r n s a value which s u c c e s s f u l l y matches the corresponding element of the source p a t t e r n . F i n a l l y , assume that the pa t t e r n match l a t e r f a i l s on some other element. Then, a l l the s i d e - e f f e c t s o f the f i r s t macro, i n c l u d i n g e x e c u t i o n i n s t a n c e s b u i l t d u r i n g e x e c u t i o n , erroneous p a t t e r n s a s s e r t e d , and so on, are s t i l l around! There i s no way around t h i s i n JLISP, but with s e n s i b l e p r e c a u t i o n s i t turns out that the problem can be circumvented. These p r e c a u t i o n s i n v o l v e making sure t h a t a JPEXPE has onl y a very few " p r o c e d u r a l " p a t t e r n s and that these have unigue f i r s t elements. P o s s i b l e c o r r e c t i o n s to JLISP i t s e l f c o u l d be made, such as f o r example, matching a l l constant elements f i r s t , or r e - d e s i g n i n g the matcher to have complete back-up c a p a b i l i t i e s i n c l u d i n g the a b i l i t y t o undo t h i n g s . However, t h i s i s not an urgent p r i o r i t y , and, i n f a c t , i t ' s open to debate whether there s h o u l d be s i n c e a fundamental philosophy o f JLISP i s keeping around a l l i n f o r m a t i o n , i n c l u d i n g b l i n d a l l e y s , f o r l a t e r p e r u s a l . 3-.5 P o i n t e r s and Searching Many times I've spoken of " l i n k s " or " p o i n t e r s " between p a t t e r n e x p r e s s i o n s . I've r e l i e d upon an i n t u i t i v e grasp of Chapter I I I 67 these terms to get across most of what I have i n mind, but there i s a much more precise meaning for "pointer" i n the system. Before giving i t , however, I would l i k e to bring out a couple of i n t e r e s t i n g features of patterns in general. One way of regarding a pattern i s as e s s e n t i a l l y an n-ary predicate whose head i s a r e l a t i o n and the rest of whose elements are the objects f i l l i n g the r e l a t i o n ' s s l o t s . In t h i s view, a pattern derives i t s meaning primarily as a result of how i t matches other patterns, although i t can be treated as a more procedural e n t i t y both i n f a i l u r e to match processing and i n the action of macros associated with i t s elements. Another equally useful view of a pattern i s as an n-ary " l i n k " amonq objects in a semantic network. The object containing the pattern i s the source of the l i n k ; the pattern elements are the objects connected by the l i n k . Thus, the pattern (TRADE SELF TICKET-BUYER MONEY TICKET} occurring i n the BUY pattern expression might be diagrammed as shown i n Figure 3.2, although many other network re a l i z a t i o n s are possible. Thus, the system can be viewed as a large semantic network of nodes (objects) and arcs (patterns) connecting the nodes. From any particular pattern expression, only the c l o s e l y connected nodes can be accessed d i r e c t l y (i.e. any objects occurring i n patterns of the |PEXPR body can be "seen"). The usual semantic network allows only binary l i n k s between objects, and for good reason: they are often (although not always) the most important kind of l i n k . Moreover, they are e a s i l y understood because they break down into three more or Chapter I I I 68 Figure 3.2 - A Small Network COMPOSER BEETHOVEN Figure 3.3 - INSTANCE-OF Link 69 l e s s well-defined parts (the source node, the destination node, and the arc i t s e l f ) and also because they can be drawn, allowing people to use t h e i r s p a t i a l i n t u i t i o n i n understanding them. In t h i s representation scheme certain kinds of patterns c a l l e d pointers take the place of binary arcs, A pointer i s a three element pattern, the f i r s t element of which i s the arc and can be any r e l a t i o n , the second element of which i s the source and must be the JPEXPfi containing the pattern, and the t h i r d element of which i s the destination and can be any object, macro expression, or sub-pattern. Thus, (INSTANCE—OF BEETHOVEN COMPOSER) occurring in BEETHOVEN would be a pointer and could be graphically i l l u s t r a t e d as in Figure 3.3. This would be termed the "INSTANCE—OF pointer from BEETHOVEN to COMPOSER". BEETHOVEN may also have a pattern (STATORE BEETHOVEN !(JPOINTER STATURE 'GREAT-MAN)) which would be a pointer to the macro expression !(|POINTER STATURE * GREAT-MAN) (unevaluated); or could have (HANT BEETHOVEN (LIKE f-'PEOPLE fBEETHOVEN-COMPOSITIONS 10)) which would be a pointer to the unevaluated sub-pattern {LIKE fPEOPLE TBEETHOVEN-COMPOSITIONS 10). It should be noted that the pointers described here are one-way pointers. Pointers to objects do sometimes have inverses, but they must be e x p l i c i t l y stored in the destination object. Thus, i f (R X Y) i s a pointer i n X, then (R-INV Y X) would be stored i n Y i f R-INV were the inverse of the r e l a t i o n S. For example, (SUPERSET CAMEL DROMODERY) i n CAMEL might have Chapter I I I 70 a corresponding {SUBSET DBOMODEBY CAMEL) in DBOMODEBY. Now, fortunately when a pattern i s asserted, the |ASSEBT J EXPR (see Appendix I) executes an IF-ADDED procedure associated with the head of the pattern. This IF-ADDED procedure hopefully knows enough to check i f the pattern i s a pointer, i f so to check with the head of the pattern to see i f there i s an inverse, and i f so to assert the inverse pattern i n the destination object. Any other IF-ADDED processing could also be undertaken. In the example, then, the r e l a t i o n SUPERSET might contain a pattern (INVERSE SUPERSET SUBSET), thus allowing |ASSERT to e f f e c t the appropriate inverse pattern. This e x p l i c i t inverse f a c i l i t y i s useful i n allowing the system to analyze i t s own rel a t i o n s ( i . e . i t can "see" what the inverse of a r e l a t i o n is) , i n forcing the user to recognize the issue of inverses rather than hiding i t with automatic inversing, and f i n a l l y i n enabling the user to choose names for the inverse r e l a t i o n that are appropriate to i t . Pointers are very useful for accessing entire environments surrounding a pattern expression; that i s , pointers of a pa r t i c u l a r type z can be followed from A to (Bl) then pointers of the same type z can be followed from £Bi} to {Ci}, and so on. A l l objects so accessed are said to be in the z-environment of A . There are many possible environments i n the system: PART-OF, THEN, ISA, EX-ENVIRON, etc. The l a t t e r two are so primary that s p e c i a l search routines have been devised to access data i n them. The ISA-environment i s the name for the Chapter I I I 71 environment that can be accessed by following EX-INSTANCE-OF, or SUPERSET pointers from some |PEXPR. I t i s the t r a d i t i o n a l "generalization 1' hierarchy into which searches can be directed for knowledge that has been abstracted from instances.. Such a search i s c a l l e d an ISA search and i s carried out breadth-first u n t i l eventually i t converges on the top object. As Fahlman (1975) has pointed out, the convergence property of ISA hierarchies, combined with t h e i r r e l a t i v e shallowness (he argues no more than 20 l e v e l s of ISA) gives hope that such searches won't be explosive. Moreover, i f the ISA link i s n ' t overused (as often i t seems to be) to delineate every kind of dependency, the branching factor should be f a i r l y small, further enhancing search times. The other major kind of search i s into the dynamic or execution environment (EX—ENVIRON) surrounding an execution instance. In t h i s environment are the supergoaIs f o r an object and the top-down decisions that have been made to t h i s point. I t thus forms a notion of context and i s consequently often searched for information as to purpose, current status of c e r t a i n features, and so on. Such a search i s c a l l e d an EX-ENVIRON search and i s l i n e a r with the number of IPEXPRs in the dynamic context. These two search types are so v i t a l , that the s p e c i a l non-pattern-matchinq macros "A" and "%» have been set up to d i r e c t them. Thus, 6(w x y z ) , i f seen by | EVAL in OB1 w i l l r e s u l t i n an ISA-search (breadth-first) from 0B1 for a pattern matchinq Chapter I I I 72 (w x y z) . %{v x y z) , i f seen by J EVAL in OB-1, w i l l r e s u l t in an EX-ENVIRON search from 0B1 for a pattern matching (w x y z) . These macros should not be confused with the pattern matching macros which are only seen by the matching routines and some other select operations. "A" and are merely convenient shorthand for actual c a l l s to the general |SEARCH routine (see Appendix I ) . Thus they can be used wherever a regular c a l l to JSEARCH could be employed. There i s s t i l l another non-pattern-matching macro, which i s merely a " ," with the difference that a l l "!", "$», " % n , " 4 " , "-»", and "/" macros are executed inside i t . Thus, ->(A !B C) would be the same as ' (A BLARNEY C) i f the value of B were BLARNEY in the context of the executing |PEXPR. 3,6 Interrupts In section 3.3-2 describing the message passing behaviour of jPEXPRs, i t was mentioned that some message patterns are fundamentally i n s t r u c t i o n s to the interpreter rather than patterns to be matched i n the body of the 1PEXPR. One example was given showing how the interpreter intercepts a (|PRIO= number) message and asserts i t i n the body of the receiving |PEXPR. There are several more esoteric, but i n many ways more useful, patterns of t h i s kind which e s s e n t i a l l y allow a super-|PEXPR to impose certain l i m i t s on the execution of a sub-|PEXPR. Chapter III 73 One such pattern i s (|T.IME= number) which puts a l i m i t on the time a |PEXPB has to answer a message. The receiving J PEXPB has "number" units of time, where the time i s measured in 100s of clock units (e.g. number = 1 implies that there i s a l i m i t of 100 clock units imposed on the sub-object's perambulations). When t h i s l i m i t i s exceeded, control returns to the JPEXPB which set the l i m i t , and i t must decide what to do. Among i t s options are to give up, to r e s t a r t the sub-object (in which case the same l i m i t s apply again), or to perform further computations i n an attempt to ascertain what to do. In more d e t a i l , t h i s i s what happens. When a (|TIME= n) pattern i s discovered during message passing, the interpreter asserts the following two patterns i n the body of the receiving execution instance: (j TIME—LIMIT= receiving-ex-instance n) (J TIME-NOW- receiving-ex-instance n) Every 100 times through |EVAL, the EXPB |U PDATE-TIMES reduces a l l |TIME-NOW= patterns i n the execution environment by 1, i . e . ||TIME-NOW= receiving-ex-instance (n-1)) replaces the previous pattern. Note that t h i s means that the I EVAL count could be out either way by up to 99 fEVAIs since a l l iTIME-NOW= patterns are reduced at once (a s i m p l i f i c a t i o n imposed for e f f i c i e n c y ) . When any given execution instance has a JTIME-N0W= pattern reduced to 0, then an interrupt i s generated, |TIME-N0W= i s reset to jTIME-LIMIT= (for the p a r t i c u l a r interrupted execution instance only), and the immediate super-goal (in the execution environment) of the Chapter III 74 interrupted execution instance i s restarted. The return condition set for t h i s kind of return i s C|RETORN-COND ex-environ-inst |TIME= (interrupted-ex-inst current-ex-inst) n) asserted in the super-goal. I f the super-goal eventually t r i e s to r e s t a r t the computation the same interrupt conditions apply. (Note also that i t must go a l l the way to the executing ex-instance rather than the interrupted ex-instance, since the executing ex-instance was actually processing at the time of in t e r r u p t ) . The timing mechanism described here i s quite crude, but even as i t stands i t i s quite h e l p f u l . JTIME= interrupts are useful f o r al l o c a t i n g time resources, especially in simulated p a r a l l e l i s m or for running i n "c a r e f u l " mode, where a process can be run for a short time before i t s c a l l e r jerks back control to make sure i t i s proceeding on course. There i s another kind of condition that can be imposed by one pattern expression on i t s descendants: the (COND= pattern) message pattern. I t e s s e n t i a l l y states that anytime there i s a pattern matching the |COND= pattern asserted by the sub-goals then an interrupt should return control to the super-goal which set the condition. Much the same kind of processing occurs here as f o r the |TIME= interrupts. That i s , a (|COND= execution-instance pattern) i s l e f t i n the relevant execution instance, and everytime the jASSERT function i s c a l l e d , i t looks into the execution environment f o r any matching JCOND= patterns for the |ASSERT pattern. Any such match results i n an interrupt being Chapter I I I 75 generated, a r e t u r n c o n d i t i o n {|RETURN-COND e x - e n v i r o n - i n s t |COND= ( i n t e r r u p t e d - e x - i n s t c u r r e n t e x - i n s t ) pattern) Being s e t i n the super-goal to the i n t e r r u p t e d execution i n s t a n c e , and f i n a l l y , c o n t r o l being resumed i n the s u p e r - g o a l . As i n the jTIHE= case, enough i n f o r m a t i o n s t a y s around f o r the whole process to be s t a r t e d again i f d e s i r e d . |COND= l i m i t s are h e l p f u l when i t i s known that a c e r t a i n sub-goal i s going wrong i f i t a s s e r t s c e r t a i n p a t t e r n s . , A f i n a l p a t t e r n o f t h i s type i s (JEND= n) which j u s t g i v e s a l i m i t on the number of times a p a r t i c u l a r sub-goal can be i n t e r r u p t e d before i t can no l o n g e r be r e s t a r t e d . Thus, a (JEND= 5) message p a t t e r n would allow no more than 5 r e s t a r t s o f an i n t e r r u p t e d sub-goal. A f t e r a |END= l i m i t has been exceeded, the r e t u r n c o n d i t i o n i s (|RETURN—COND e x - e n v i r o n - i n s t |END= ( i n t e r r u p t e d - e x - i n s t c u r r e n t - e x - i n s t ) v a l - i n t ) where " v a l - i n t 1 ' i s a time l i m i t or a patte r n depending on which k i n d of i n t e r r u p t sent the j END= l i m i t over the top. T h i s i s u s e f u l i n e l i m i n a t i n g p o t e n t i a l i n f i n i t e loops o f sub-goal r e s t a r t s . One f i n a l p o i n t of i n t e r e s t : the EXPRs JSEHON and |SEMOFF w i l l t u r n a f l a g (semaphore) on or o f f i n the c u r r e n t p a t t e r n e x p r e s s i o n . Before doing any JTIME= or jCOHD= i n t e r r u p t checking, the c u r r e n t s t a t u s of the nearest such f l a g i n the ex e c u t i o n environment i s determined, and i f i t i s on, no i n t e r r u p t s are processed anywhere i n the e x e c u t i o n environment. Chapter I I I 76 3.7 Simulated Parallelism There are two ways to simulate parallelism i n the system. The f i r s t uses |TIME= l i m i t s to e s s e n t i a l l y assign time s l i c e s to each sub-goal. A |END= l i m i t can be used to l i m i t the number of r e s t a r t s f o r a p a r t i c u l a r object. Thus, {|PARALLEL {object 1 {|TIME= n1) rest-of-message-patterns) (object2 (JTIME= n2) rest-of-message-patterns) (objectk {JTIME= nk) rest-of-messa ge-patterns) ) w i l l send o b j e c t l ' s message patterns to objectl for time s l i c e a1, then w i l l send object2*s message patterns to object2 f o r time s l i c e n2, and so on through objectk. The process i s then repeated, restarting every object which had a jINTERRUPT—TIME= return condition for another time-slice, but, of course ignoring those with NORMAL return. This goes on u n t i l either a l l have terminated normally or u n t i l |END= l i m i t s {if any) have been exceeded. The other way of simulating parallelism makes use of p r i o r i t i e s and the execute gueue. Several objects can be scheduled at once with d i f f e r i n g p r i o r i t i e s , and they w i l l eventually run i n the order of t h e i r p r i o r i t i e s . I f these are to be restarted, however, they must be e x p l i c i t l y resumed by the pattern expression which scheduled them. The EXPR |SCHEDULE can be used to accomplish t h i s : {|SCHEDULE objectl object2 . . . objectk) Note also that the objects must somehow be i n i t i a l i z e d with t h e i r messages and so forth i n place. This method doesn't tend Chapter III 77 to be too convenient or to give much control over resource a l l o c a t i o n for each object, but i t i s useful f o r a much quicker kind of breadth-first a b i l i t y than the time-slice method qives. This concludes the description of the c a p a b i l i t i e s of the current version of JLISP. In Chapter IV I would l i k e to evaluate the scheme by comparing i t to other approaches and by lookinq at i t s strengths and weaknesses. Chapter I I I 78 CHAPTER IV An Evaluation of the Representation Scheme The system f o r organizing knowledge presented i n the l a s t chapter has been described more or less at face value without any attempt to evaluate i t . In t h i s chapter I would f i r s t l i k e to compare the scheme developed here to some other approaches, p a r t i c u l a r l y the PLANNER / CONNIVER language development and the frame proposal i n i t s many guises. In thi s way the influences on t h i s research should be revealed and the strengths and weaknesses should become cl e a r e r . I would then l i k e to focus back on the representation and language issues to see i f the approach outlined here does indeed shed l i g h t on any of them. 4.1. The PLANNER £ CONNIVER Accroach The most important influence on JLISP has been the PLANNER / CONNIVER {Hewitt {1972), Sussman and winograd (1970), acDermott and Sussman (1974)) development, complete with the Bobrow and Wegbreit (1973) control paradigm. Since CONNIVER embodies most of the c r u c i a l aspects of t h i s l i n e of research, I w i l l mainly use i t for comparison. The es s e n t i a l features of CONNIVER are (i) a data base of contexts, each containing assertions and methods, and each representing some state of the world; Chapter IV 79 (ii ) a pattern matcher, replete with s p e c i a l macros, to access data i n t h i s data base; ( i i i ) a varied set of procedures to manipulate the assertions; (iv) a co-routine control structure to implement a l l t h i s . H.1.1 The Data Rase The major difference between JLISP and COHNIVER i n regard to the data base has to do with the separation of context from contr o l . In |LISP there i s no separate context mechanism: contexts are inex t r i c a b l y bound to pattern expressions (since pattern expressions are the primary object of (LISP, their features w i l l be used almost always in explanations and j u s t i f i c a t i o n s ) , and cannot ex i s t independently. This i s , I f e e l , an important conceptual point (also made by many recent systems, e.g. Bobrow and Winograd (1976), Hendrix (1975), Havens (1977), Sandewall (1975)): a l l data i s associated with some de f i n i t e "object" and has meaning only when that object has meaning to the system. To be sure i f i t i s desired to t i e a context to a part i c u l a r access environment, CONNIVER can use a variable CONTEXT that can be set in that environment to point to the context, but t h i s i s both awkward and ignores the usefulness of considering contexts to be objects that can be reasoned about, sent messages to, and otherwise treated l i k e other objects. The assumption of object - context i d e n t i t y i s one of Chapter IV 80 the more u n i f y i n g concepts i n the system, and e l i m i n a t e s the d i s t i n c t i o n between data i n one place and procedures o p e r a t i n g on the data i n another. Contexts a l s o d i f f e r from p a t t e r n e x p r e s s i o n s i n t h a t c o n t e x t s are arranged i n a " v i s i b i l i t y h i e r a r c h y " while IPEXPRs are on the s u r f a c e a l l i n v i s i b l e to one another. But, t h i s i s only on the s u r f a c e : |PEXPRs c o n s i s t of p a t t e r n s which can c o n t a i n elements t h a t are the names of other IPEXPRs, and hence th e r e can be, i n essence, a r b i t r a r y l i n k s between IPEXPRs. These l i n k s can be t r a v e r s e d by sending messages along them and r e c e i v i n g r e p l i e s , thus making data i n IPEXPRs a v a i l a b l e to one another. Although t h i s i s powerful, i t does tend t o be somewhat slow f o r simple data access; hence, the |LISP p r o v i s i o n of s p e c i a l e x e c u t i o n and ISA environment searches that speed up a t l e a s t a couple of the more commonly needed access methods. H-l-Z P a t t e r n Matching |LISP's matcher v a r i e s l i t t l e i n any t h e o r e t i c a l way from CONNIVER's. As i n CONNIVER, i t i s u s e f u l f o r a c c e s s i n g data, i s u s e f u l f o r i n v o k i n g processes (in f a c t i t goes one s t e p f u r t h e r than CONNIVER and becomes j u s t about the only way of i n v o k i n g process, given the preponderance of IPEXPRs i n the system), and has the other normal p a t t e r n matching f e a t u r e s . There a r e , however, a couple of noteworthy d i s t i n c t i o n s , at l e a s t i n d e t a i l . F i r s t , the macros in J LISP are somewhat d i f f e r e n t and, 1 t h i n k anyway, give a b i t more f l e x i b i l i t y ( e s p e c i a l l y "=" and "#"). Second, the matcher i s t o t a l l y symmetric i n |LISP, Chapter IV 81 displaying no preference to source pattern over target pattern as i s the usual case. In fact there i s no d i s t i n c t i o n between patterns and assertions at a l l , further unifying the system. But, most important i s the "don't give up" feature of JLISP's matcher: i f i t i s unable to find a match within the body of a 1PEXPB, i t may (at the discretion of the pattern head) look elsewhere for a match. This gives robustness and power to the matcher; i t also has the drawback of pote n t i a l l y getting out of hand combinatorially, l i k e any other such automatic deductive system. With c a r e f u l selection of f a i l u r e to match conditions, I hope that this drawback remains only potential! i*1•3 Procedures In CONNIVES there are at least four d i s t i n c t kinds of procedure: ordinary LISP functions, CONNIVES procedures, methods, and generators. In JLISP there are also several d i f f e r e n t kinds of procedure, including LISP functions, JLISP procedures, and JPEXPBs. The interesting comparisons are between methods and generators on the one hand and JEXPBs and JPEXPBs on the other. The idea of methods i s that they should be part of the data base and that they should work to keep i t consistent and also help i n accessing data from i t . The problem with them tends to be one of combinatorial explosion (another of those automatic features!) IF-ADDED and IF-BEHOVED methods have been f a i r l y d i r e c t l y incorporated as procedural patterns associated with selected JPEXPBs ( i . e . those whose name can appear as a pattern head). Chapter IV 82 Such "methods" are c a l l e d in whenever a pattern with that head i s |ASSERTed or JREMASSERTed. This d i f f e r s somewhat from CONNIVER i n that the pattern matching to fi n d a method i s r e s t r i c t e d to only scanning patterns of the head j PEXPR, not the en t i r e data base. Of course, the method i t s e l f , once activated, could do any amount of (possibly explosive) further processing, but since I am not overly concerned about the existence of contradictory information (as long as i t i s n ' t present i n the same execution environment), I don't v i s u a l i z e such methods as being too elaborate. IF-NEEDED methods have an analogy in the f a i l u r e to match processing of jPEXPR message passing; that i s , a f a i l u r e to match "method" i s c a l l e d in only i f i t i s needed because of a lack of suitable patterns i n a receiving |PEXPR. The difference between IF-NEEDED methods and f a i l u r e to match processing i s once again that the search for a FAILURE-TO-MATCH pattern reguires the matcher to only look through one |PEXPR (the |PEXPR corresponding to the "head" of the f a i l e d pattern), not through the entire data base. Generators are CONNIVER co-routines which can be executed u n t i l they produce some datum, and can l a t e r be re-entered i f the datum proves unsatisfactory. Both J EXPRs and JPEXPRs give a s i m i l a r co-routine a b i l i t y , |EXPRs by allowing the saving of stack pieces within a J PEXPR, and JPEXPRs by keeping an execution instance around which can l a t e r be restarted. For e f f i c i e n c y , the usual way of doing generation i s by using |EXPRs; in fact the J SEARCH generator c a p a b i l i t i e s are Chapter IV 8 3 implemented i n just t h i s way. The r e a l l y important d i s t i n c t i o n between |LISP and CONNIVES procedures i s , however, the r o l e they play in the o v e r a l l scheme of things. CONNIVES i s set up as b a s i c a l l y a LISP-style procedural language with occasional forays into pattern directed invocation as a necessary declarative component. JLISP on the other hand, i s b a s i c a l l y b u i l t around pattern matching, and the procedural c a p a b i l i t i e s drop out as more or l e s s a side e f f e c t of t h i s matching. Thus, most procedures are in fact embedded as n i n o r H J I I macros in patterns of JPEXPRs, not as separate functions. This means they are treated much as any data would be (e.g. they are present or absent only i f the J PEXPR containing them can be looked a t ) . Hopefully, this i s one small step along the road to unifying data and procedures, although to be sure many global and d i s t i n c t l y functional objects remain (e.g. EXPRs, SOBRs, J EXPRs) . H-l*H Control CONNIVER's control i s fundamentally that of Bobrow and Wegbreit (1973). So i s that of JLISP: that i s , CLINKs are eguivalent to EX-ENVIRON pointers; execution instances are Bobrow and Wegbreit frames (except they aren't separated into two parts, and hence there i s no BLINK); there i s a continuation point, return condition, etc. s i m i l a r to that of Bobrow and Wegbreit, There are, of course, differences. There i s no ALINK since i t s data accessing function has been somewhat taken over by more semantically relevant (to the domain being represented) Chapter IV 84 concepts such as SUPERSET, INSTANCE-QF, etc. That i s , i t i s often necessary to access data i n a variety of environments such as execution, ISA, etc., rather than i n one a l l encompassing access environment. The s p e c i f i c a b i l i t y that the ALINK / CLINK d i s t i n c t i o n provides of allowing a process to access data i n one environment while returning control to another can be accomplished i n the j LISP scheme of things by sending a message to an old named execution instance. To handle t h i s message a new execution instance of the old execution instance must be created. The old execution environment can be accessed using the old execution instance's "CLINK"; the new execution environment can be accessed using the new execution instance*s "CLINK". Having two execution instances i s necessary i f old "episodes" are to be kept d i s t i n c t from new "episodes" (see Appendix I - JRESTART -for a description of how t h i s methodology can be used to resume execution of a previously suspended JPEXPR). This i l l u s t r a t e s another major difference between JLISP and CONNIVER: data, including i n t e r n a l pointers, are stored i n execution instances i n patterns just as i s any other data i n any other JPEXPR. In fact execution instances are JPEXPRs l i k e any others. Thus, the patterns can be accessed using standard matching, and moreover, old execution instances can be gueried to provide episodic information about what went on i n that context. S t i l l another d i s t i n c t i o n between JLISP and CONNIVER control i s that execution instances stay around rather than Chapter IV 85 disappear upon return. The only automatic garbage c o l l e c t i o n i s done on stacks within execution instances; the instance i t s e l f does not get collected on return. Instead i t must be i n t e l l i g e n t l y " garbage collected at some l a t e r date. How such a garbage c o l l e c t o r would make i t s decisions has not been a central issue of t h i s research, but some speculations are given i n Chapter VI. In CONNIVER a l l procedures (with the exception of cer t a i n macro-directed LISP c a l l s ) have a Bobrow and legbreit frame created for them; t h i s i s not the case i n (LISP. Except for messages between JPEXPRs, an execution instance i s not set up upon a c a l l to a procedure, the current JPEXPR stack being used instead. Variables are accessed on the current JPEXPR stack, and i f not found there are bound in stacks of JPEXPRs in the execution environment of the current jPEXPR. This use of JPEXPR stacks i s somewhat l e s s wasteful on space and time i n the many cases when JPEXPRs are not communicating; in the few cases they are, however, the overhead of i n i t i a l i z i n g and l a t e r accessing data in patterns probably more than makes up for the saving i n the majority of cases. Another difference between LISP and CONNIVER control involves the use of a scheduler to buffer contact between JPEXPRs. Of course, i t i s f a i r l y easy to implement such a scheme in CONNIVER (as was done i n the Reference Manual (McDerraott and Sussman (1974)), but JLISP e x p l i c i t l y does so. While engendering some overhead, such a scheme enables pseudo-parallelism, and adds f l e x i b i l i t y to the system; i t Chapter IV 86 doesn*t seem too important otherwise, however. Belated to t h i s i s the JTIME= and SPACE= conditions that can be imposed on the execution of a |PEXPR. CONNIVER has an interrupt feature that seems to be mainly useful for error generation and co-ordinating various c o n f l i c t i n g methods. The one here i s much more e x p l i c i t and much more fundamental to the problem of a super-goal l i m i t i n g the a l l o c a t i o n of resources to a sub-goal or otherwise imposing conditions on that sub-goal. This i s s t l l only a crude approach (being both slow and rather cumbersome and inexact), and much more sophistication would be needed i f a t r u l y useful interrupt feature were to be i n s t a l l e d . However, I do f e e l i t i s a step beyond CONNIVER i n t h i s regard. ii * 2 Frames In t h i s section I lump together a l l the work which has gone under various labels (frames, schemata, s c r i p t s , knowledge sources, s o c i a l action paradigms, etc.) but which among other things i s c e n t r a l l y concerned with dividing a knowledge base into large modular units each of which contains a l l the information relevant to a particular concept. In JLISP, pattern expressions are the eguivalent of frames, since they represent large chunks of semi-independent knowledge. There are many issues raised by the various frame proposals and I would l i k e to concentrate on a few important ones; why are frames needed, what do frames look l i k e , and how do they connect Chapter IV 87 to other frames both s t a t i c a l l y and dynamically. I intend to compare various other approaches to JLISP i n the hopes of i l l u s t r a t i n g some of i t s contributions. 4*2.1 I i i i are Frames Heeded? Frames have been suggested, ba s i c a l l y , as a compromise between too much complexity on the one hand and combinatorial explosion on the other. as Hinograd (1974) has demonstrated, a system must steer a middle course between having lots of l o c a l h e u r i s t i c s that help i t decide precisely and e f f i c i e n t l y what to to i n various s p e c i f i c contexts (but at the expense of making i t almost incomprehensible due to s i z e ) , and using a few widely applicable techniques which are easy to understand because there aren't many of them (but which leave the system vulnerable to uncontrolled computation). Frames, i t i s hoped, w i l l help to resolve t h i s problem f i r s t because they give a way of packaging information into d i s t i n c t modules that can be considered separately, thus keeping the system comprehensible; and second because they tend to represent much of the i r information d e c l a r a t i v e l y while s t i l l allowing procedural information at the frame l e v e l , thus giving the understandability of declarative structures while maintaining the procedural c a p a b i l i t y that makes for e f f i c i e n c y . Hinograd (1975) has c a l l e d the issues raised by t h i s trade-off the procedural / declarative controversy. I f e e l that pattern expressions contribute some things of worth here. Certainly, they allow information to be packaged Chapter IV 88 into groups of patterns which contain the basic " f a c t s " about some concept, hence allowing the concept to be (at lea s t p a r t i a l l y ) considered apart from i t s comrades. Thus, they are guite well suited to the f i r s t r o l e above. The problem becomes the information that i s n ' t d i r e c t l y i n a |PEXPR but must be accessed from some other object - i s there too much of th i s kind of inter-object a c t i v i t y to maintain the modularity? This, of course, i s a c r u c i a l problem for a l l frame systems, and I can only say that at this early stage I share the general frame f a i t h that the packaging can often be done successfully. The second contribution of frames i s to procedural / declarative issues. In t h i s respect there seem to be two main views of frames: (i) Frames are uniform, mostly declarative structures which are processed by a single global interpreter. Most of the purely procedural aspects are subliminated i n t o the interpreter and more or less hidden from the user. Systems of t h i s i l k include Schank and Abelson (1975), Charniak (1975), and Bruce (1975). ( i i ) Frames consist b a s i c a l l y of two parts, one a mostly declarative section containing s t a t i c information, and the other a procedural component which i s used to interpret the declarative portion and otherwise handle inter-frame communication. Among systems of t h i s genre are MAYA (Havens {1977)) and KRL (Bobrow and Hinograd <1976)). Although there are aspects of both of these approaches i n JLISP ( i . e . JPEXPRs are uniformly interpreted but by JPEXPR-MH, Chapter IV 89 a message handler associated d i r e c t l y with the JPEXPR i t s e l f ) , the main thrust of the scheme i s to lower the procedural aspects of a JPEXPR to the pattern l e v e l . Thus, procedures are encoded as "!" or w$" or "=" macro elements which are expanded when the pattern i s being used to answer a message. Such macros allow a pattern to represent very procedural kinds of goaling information or to represent very s p e c i f i c context dependent knowledge d i r e c t l y with the pattern that needs to use i t so that the |PEXPR as a whole doesn't have to be concerned with i t . Moreover, since most elements of even these patterns are non-procedural, and i n fact e n t i r e patterns without procedural elements are common, and i n either case such patterns are accessed using the same matching scheme, this c e r t a i n l y seems to contribute to a more unified view of procedures and data. S t i l l more encouraging i s that after a |PEXPR has answered a message, the r e s u l t i n g answer pattern i s jASSERTed i n the receiving execution instance as a declarative residue of procedural a c t i v i t i e s . Thus, i n theory at l e a s t , having pattern l e v e l macro c a p a b i l i t i e s allows procedural f l e x i b i l i t y to be inserted into examinable, mostly declarative structures. In practice, however, the temptation seems strong to use too many macros, and to write macro code that i s much too complex to be understandable. It i s thus important for any system using JLISP to attempt to abstract such low l e v e l procedures into a more declarative plane by somehow representing what they do i n terms of higher l e v e l primitives. This i s a d i f f i c u l t task (in many Chapter IV 90 ways i t i s the ce n t r a l task of a l l of a r t i f i c i a l i n t e l l i g e n c e ) , but at least |LISP gives the modeller the choice of l e v e l at which to represent knowledge. 4.2.2 What do Frames Look Like? There are as many different representations for frames as there are frame systems. I don't intend to go into a lengthy discussion of the syntax or even the semantics of the various schemes; instead, I would l i k e to discuss some concepts that seem to pop up a l l over, s p e c i f i c a l l y the concept of s l o t s , the concept of pre-conditions and post-conditions, and f i n a l l y some issues in representation of knowledge that frames i l l u s t r a t e . , Hinsky (1974) has proposed that a frame i s composed of cer t a i n fixed information at the top le v e l s and ce r t a i n s l o t s at the bottom l e v e l s which must be f i l l e d when the frame i s instantiated. A s l o t has associated with i t markers or other i n d i c a t i o n s as to how to f i l l i t , the importance of the s l o t to the frame, what to do when the s l o t i s f i l l e d , e tc. iinograd (1975) and Bobrow and Winograd (1976) have generated a comprehensive computational description of s l o t s , complete with attachment of procedures to f i l l the s l o t s (perhaps by i n h e r i t i n g such procedures from other frames), the designation of important s l o t s (so-called IMPs), the provision of procedures that are executed once the s l o t i s f i l l e d , default values of varying "looseness" to f i l l the s l o t i f nothing else can be found to do so, etc. In pattern expressions there are no s l o t s ; at least, there Chapter IV 91 are no e x p l i c i t d i s t i n c t i o n s made between patterns which are unvarying i n the sense they contain no macro elements and patterns which are changeable because of macro elements. The r o l e of s l o t s i s taken by such macro elements. These " s l o t s " are f i l l e d when the j PEXPB i s being queried for information by some other |PEXPB and only then. They can be f i l l e d by simple variable bindinq (as i n the macro "?") or f i l l e d by complex procedure (as i n the macro "!") or f i l l e d under certain conditions (as i n the macro "=") etc. And i f there i s no pattern i n the J PEXPB which matches the incoming pattern, then a procedural attachment from some other frame can occur ( i f the pattern head recommends i t ) . Certain patterns can be indicated to be more important by using meta-patterns that contain them (e.g.. {IMPORTANCE (TEONDLE ELMER BOOM4) 9) or (IMPOBTANCE /S29 9) i f the TBDNDLE pattern has l a b e l S29). This use of meta-patteras i s discussed more f u l l y in Chapter VI, but i t does provide a way to designate IMPs {even though I haven't found such designations to be a l l that he l p f u l i n the well-constrained examples I have explored). Many frame systems (e. g. Bruce (1975), Charniak (1975), Schank and Abelson (1975)) talk i n terms of pre-conditions which are rapid checks that must be s a t i s f i e d before a frame can be considered to be relevant and post-conditions which are the r e s i d u a l e f f e c t s of the frame's a c t i v a t i o n . These conditions are usually in declarative form so that they can be e a s i l y understood by the user and so that they can be matched against the data base on entry (for pre-conditions) or asserted i n the Chapter IV 92 data base on exit (for post-conditions). I believe there i s something quite i n f l e x i b l e about the pre-condition / post-condition scheme as usually outlined: such processinq i s done a l l at once without reqard to context. I t seems more p r a c t i c a l to provide some much more procedural c a p a b i l i t y where a frame i s able to pick and choose what tests to carry out i n deciding whether i t i s relevant. Moreover, i t should be able to be contextually s e l e c t i v e i n reqard to what i t leaves as residue once i t i s done. Of course, these various tests would have to be f a i r l y simple or the whole purpose of pre-conditions (and to a lesser extent post-conditions) would be obviated. In JLISP there are no e x p l i c i t pre-conditions or post-conditions, although, as always, p a r t i c u l a r users have the c a p a b i l i t y of adding (PRE-CONDITION ) or (POST-CONDITION ) patterns to pattern expressions. What l i t t l e pre-condition s t y l e testing there i s i s undertaken by procedures within elements of patterns as they attempt to respond to messages; post-condition s t y l e processing occurs when these procedures as a side-effect assert new patterns (usually i n the body of the current execution instance). The key point i s that the processing can be undertaken when wanted by the relevant receiving pattern, and i s n ' t r e s t r i c t e d to an all-or-nothing lump associated with the entire J PEXPR regardless of the receiving pattern. This explanation has suppressed a rather important use of pre-conditions: t h e i r s i g n i f i c a n c e i n pattern-directed Chapter IV 93 invocation; that i s , i t i s usually something l i k e pre-conditions that are used when testing f o r the relevance of any frame before l e t t i n g i t loose. While for the areas in which |IISP has been used so far i t has usually s u f f i c e d for JPEXPEs to know each other by name, i t i s a c r u c i a l a b i l i t y to be able to invoke JPEXPRs in some less direct way. To thi s end, an associative a c t i v a t i o n scheme i s i n the early stages of development. I t e s s e n t i a l l y allows JPEXPRs to contact each other along " l i n k s " i n the i m p l i c i t semantic network i n which they are embedded {see section 4.2.3 f o r a f u l l e r explanation of this semantic network). Associative activation i t s e l f i s described to a greater extent i n Chapter VI. At this point I would l i k e to consider some important issues about how information i s represented i n a frame. f i r s t , take the d i s t i n c t i o n between concepts which d i r e c t l y concern the frame and concepts which are not so ce n t r a l . This i s b a s i c a l l y Woods1 (1975) d i s t i n c t i o n between d e f i n i t i o n a l properties and asser t i o n a l properties, and i n fac t has been e x p l i c i t l y included as such i n some systems {e.g. Levesgue (1977)). I believe that the assertional / d e f i n i t i o n a l categorization i s r e a l l y a c a t c h - a l l and should be s p l i t into many dimensions, each of which delineates a d i f f e r e n t aspect of a concept's relevance to a frame. This i s not a new idea, so that Tesler et a l (1968) outline several such dimensions (e.g. charge, s i g n i f i c a n c e , c r e d i b i l i t y , foundation), Winograd (1975) talks about IMPs, Becker (196 9) proposes c r i t e r i a l i t y . In JLISP, of course, no commitment has been made to tine particular dimensions to choose Chapter IV 94 (although IMPOSTANCE and COSE are two such dimensions used by some system procedures); but the user can specify any that he desires by using meta-patterns (see Chapter VI f o r a more comprehensive description of these). another issue arises i n systems (such as, for example, KBL (Bobrow and Winograd (1976)) or MAYA (Havens (1977))) which choose to encode information concerning the containing frame as att r i b u t e / value pairs, while other information i s encoded as ar b i t r a r y assertions. Thus, the facts that CASA-LOMA i s a c a s t l e and i s in Toronto would be kept in the CASA-LOMA frame as at t r i b u t e / value pairs (ISA CASTLE) and (LOCATION TORONTO) while another relevant piece of data {ISA PARAPET TOWER) would be stored in CASA-LOMA as a three element assertion. While often a useful abbreviation, such an e x p l i c i t syntactic difference can be harmful i n that the same piece of information may have to be represented i n two d i f f e r e n t ways depending on where i t i s stored (e.g. i t would be s u f f i c i e n t to use the att r i b u t e / value pair (ISA TOWER) i n the frame PARAPET). In j LISP a l l patterns are f u l l blown patterns, since not to do so would present d i f f i c u l t i e s to f a i l u r e to match processing by making i t hard f o r the pattern head to know the number of "arguments" of the pattern that has f a i l e d . The use of " f u l l " patterns also helps point out a problem which many systems seem to be able to finesse by the use of att r i b u t e / value pairs. This i s the problem of representing in h e r i t a b l e data i n the ISA hierarchy. Thus, an att r i b u t e / value approach might put (NUMBER-OF-LEGS 2) with the Chapter IV 95 PERSON frame and be t o t a l l y unambiguous. But when i t i s r e a l i z e d that what i s r e a l l y being said here i s (NUMBER-OF-LEGS PERSON 2), then a d i f f i c u l t y becomes apparent: the class PERSON does not have 2 legs; instances of the class do. I LISP forces t h i s kind of d i s t i n c t i o n to be made e x p l i c i t l y , e.g. (NUMBER-OF-LEGS fPERSON 2). Even with at t r i b u t e / value pairs, a system w i l l f a i l i f something l i k e (SELLS ALCOHOLIC-DRINK) were to be associated with the BARTENDER frame. What i s r e a l l y meant here i s that an arbitrary instance of the class of bartenders s e l l s an arbitrary instance of the class of a l c o h o l i c drinks, i . e . (SELLS f/BARTENDER tALCOHOLIC-DRINK) . To be sure, frames encoding the SELLS or NUMBER-OF-LEGS relations could keep t h i s information straight, but for now, at l e a s t , i t seems to me to be better to be e x p l i c i t about what information i s about instances and what about objects. The more so since t h i s has some relevance to a c l o s e l y related issue: the problem of discriminating "meta" information about the frame i t s e l f from " r e a l world" information about the object represented by the frame. This d i s t i n c t i o n has not always been well delineated i n AI or elsewhere for that matter. Keeping information about instances d i s t i n c t from information about classes helps somewhat here. However, i t doesn ,t solve the whole problem: the pattern (NAME FRAME27 ALFRED) could mean that the instance FRAMI27 i t s e l f i s named ALFRED or that the person referred to by FRAME27 i s named ALFRED. Which i s right depends on what i s meant by NAME i n the system. If NAME means Chapter IV 96 "the name of the object represented by the second element i s the thing in the t h i r d element" then f i n e ; but there had better be another r e l a t i o n INT-NAME, say, indi c a t i n g "the name of the in t e r n a l object that i s the second element i s the third element", so that (INT-NABE FRAME27 FRAME27) could be used. The burden for keeping t h i s straight i s on the system user, although once he has decided what's what, he can put information with the re l a t i o n i t s e l f i n d i c a t i n g whether i t i s a " r e a l world" or "meta world" r e l a t i o n . As w i l l be seen i n Chapter VI, when two JPEXPRs are being compared, i t i s often inconvenient to guery each pattern head as to whether i t i s relevant to the comparison. Thus, a in eta-pattern {CORE ZORK /PAT 1 /PAT2 . . . /PATn) in d i c a t i n g sub-patterns which are the core concepts of ZORK can be asserted. This, too, i s useful i n delimiting i n t e r n a l from domain information. No doubt other meta-patterns could be b u i l t to further specify f i n e r d i s t i n c t i o n s , but t h i s hasn't been of cen t r a l concern to the research. An int e r e s t i n g thing should be noted at this point having to do with the type / token d i s t i n c t i o n . When an old execution instance i s sent a message, to respond to that message an execution instance of that execution instance i s set up just as i t would be f o r any message to any other |PEXPR. This allows the old execution environment to be discriminated from the new {see section 4 . 1.4); i t also means that e f f e c t i v e l y there are instances of instances i n JLISP. This approach i s s i m i l a r to Chapter IV 97 Q u i l l i a n f s (1969) TLC system, d i f f e r i n g only in that contrary to TLC's uniform subset / superset designation, i n jLISP the user i s encouraged to make a d i s t i n c t i o n between an instance, which represents an i n d i v i d u a l , and other jPEXPBs which are not ind i v i d u a l s but are rather classes or sets or viewpoints or whatever. 4.2.3 Inter-frame Connections Because a frame cannot know everything about everything, an important aspect of frame theory involves the manner in which frames pass information amongst themselves. There seem to be at le a s t two diff e r e n t components to thi s a b i l i t y : s t a t i c connections and dynamic connections. In the former case, certain s t a t i c pieces of information are contained i n several frames at once; i n the l a t t e r case, one frame e x p l i c i t l y c a l l s i n another frame to achieve some purpose or gain some information. Looking f i r s t at s t a t i c connections, there are b a s i c a l l y two issues here: the sharing of s t a t i c information amongst frames, and the presence of certain s t a t i c l i n k s connecting frames. Minsky (1974) and l a t e r Charniak (1975) talk i n terms of c o l l e c t i o n s of related frames "sharing terminals", that i s when a s l o t i s f i l l e d in frame & as i t recognizes a scene, the same s l o t may also be f i l l e d i n frame B automatically. Such shared information allows frame B to save work i f i t eventually must be c a l l e d i n to recognize the scene. This a b i l i t y also i s very useful i n deciding what frames are related to one another; Chapter IV 98 that i s , i f two or more frames share the same information, then t h i s i s persuasive evidence that they are somehow related. In |LISP "terminal sharing" amongst JPEXPRs i s not encouraged: patterns are contained in "boxes" which aren't supposed to share t h e i r information with one another. Sharing of patterns should only be undertaken by message passing between JPEXPRs., This means that i f a JPEXPR turns out to be unsuited for a p a r t i c u l a r task, then any patterns i t has asserted w i l l not be automatically copied over to the new jPEXPR which i s c a l l e d i n to replace the unsuitable one. Instead, the new jPEXPR i s given the perogative to decide on i t s own what things, i f any, i t may attempt to salvage from i t s comrade. This i s a procedural approach to the "shared terminals" problem, and probably i s not very satisfactory since, although i t allows a r b i t r a r y s e l e c t i v i t y and preciseness i n the sharing, i t may also be far too complex to be useful. However, even Minsky's scheme i s s t i l l i n i t s formative stages, and i t has problems the other way (not enough s e l e c t i v i t y ) . A l l in a l l t h i s seems a very deep issue and not one ready for early s o l u t i o n . A s i m i l a r kind of sharing happens in the Hendrix (1975) semantic network formalism, where a net i s divided into p a r t i t i o n s which can share information. Such a d i v i s i o n allows the same information to be " v i s i b l e " from certain perspectives but not from others, and hence i s of f a c i l i t y i n perusing only those features which are relevant at any time. This i s not the place for a f u l l discussion of context (see Chapter VI), but i t must be pointed out that the " p a r t i t i o n s " of JLISP are the Chapter IV 99 pattern expression "boundaries", and that there i s thus no sharing of data per se between p a r t i t i o n s . However, as i n the case of shared terminals, a procedural solution involving message passing can be (rather u n s a t i s f a c t o r i l y ) pressed into service whenever information i s to be shared. I t i s safe to say that the lack of shared information i s one of the weaker aspects of |LISP as i t stands today. The attempt to keep the system as modular as possible has perhaps been too severe and although i t has meant greater precision by forcing procedural sharing, i t seems to have contributed to rather than helped to solve the complexity problem. The other s t a t i c aspect of inter-frame connections i s the attempt to e s s e n t i a l l y embed frames into a semantic network. Minsky*s (1974) proposal suggested a s i m i l a r i t y network connecting frames, the l i n k s of which would be "differences" to follow i f the frame were not properly matched to a s i t u a t i o n . Winograd (1975) has been keen on investigating how and whether frames f i t into a Q u i l l i a n (1969) s t y l e generalization hierarchy; Levesgue (1977) has also been interested i n such a hierarchy as well as other " l i n k s " between frames; and Havens (1977) has a f u l l - s c a l e net surrounding his frames. These researchers have recognized that i t i s c r i t i c a l to the e f f i c i e n t operation of a system that a frame have semantically close neighbours that i t i s able to guickly access i n a variety of common sit u a t i o n s (e.g. inheritance of properties along ISA l i n k s , following a difference pointer when a certain kind of f a i l u r e occurs within a frame). Chapter IV 1 0 0 JLISP pattern expressions can also often be prof i t a b l y viewed as i f they were embedded i n a semantic network, but as w i l l be shown, i t i s a rather strange network. This can be accomplished by viewing the patterns of a JPEXPB as (arc node-1 node-2 . . . node-n) combinations. Even though JLISP doesn't i n s i s t on th i s view (that i s i t would, f o r example, be possible to look at a pattern as (node-1 arc -1 node-2 . . . arc-n) or some such), i t i s i n most cases convenient to consider the f i r s t element to be an arc and the rest nodes. In par t i c u l a r , the a r c - f i r s t notation i s most appropriate for patterns which are pointers (see section 3.5). For • example the patterns (SOPEBSET DOG MAMMAL) i n DOG, (SOPEBSET MAMMAL ANIMAL) in MAMMAL, and (SOPEBSET ANIMAL PHYSOBJ) i n ANIMAL could be viewed as i n Figure 4.1. Although pointers are important, and do i l l u s t r a t e how JLISP can do semantic network-type things, i t must be remembered that they are only one p a r t i c u l a r l y nice subset of the range of useful patterns available for use i n a JPEXPB - there can be n-ary r e l a t i o n s , r e l a t i o n s which don't involve the name of the J PEXPB in which they are contained, r e l a t i o n s with macros, etc. These are rather hard to draw (and hence somewhat opaque), but they do share the connectivity property so important to a semantic network i n that the only other objects which can be seen from the viewpoint of any JPEXPB are those whose names appear in patterns of the jPEXPB. Moreover, they extend the network concept to be able to ea s i l y handle more complex kinds Chapter IV 101 SUPERSET-SUPERSET-SUPERSET' PHYSOBJ ANIMAL MAMMAL DOG Figure 4.1 - SUPERSET Pointers 102 of information, es p e c i a l l y through the use of macros i n the patterns and by allowing non-binary l i n k s . The other major aspect of interframe behaviour involves dynamic communication amongst frames to accomplish various tasks, such as matching data, achieving a sub-goal, i n s t a n t i a t i n g a frame. Minsky and for that matter most frame t h e o r i s t s are not p a r t i c u l a r l y concerned with the many procedural components that seem necessary; but these aspects are dealt with by several groups, including Bobrow and Winograd (1976) i n KRL, Hewitt (1975) i n his AC TOE formalism, and Havens (1977) i n MAYA. This research has led to the d e f i n i t i o n of several important procedural concepts, among them procedural attachment, multi-processing, messages and message passing. Procedural attachment i s Winograd fs (1975) term for the c a l l i n g i n or attaching of a process to a frame so that i t can be "triggered" to solve some problem. Bobrow and Winograd (1976) delineate at least a couple of useful classes of procedure: servants or TO-FILL triggers used to achieve some goal such as f i l l i n g in a s l o t (and cl o s e l y related to MICRO-PLANNER THCONSEs or CONNIVER IF-NEEDEDs) ; and demons or WHEN-FILLED tr i g g e r s used to derive the conseguences of achieving a goal (corresponding to THANTEs or IF-ADDEDs). Such procedures can be d i r e c t l y attached to the frame they serve or even to parts of that frame, or can be inherited from other frames. j LISP, too, has procedural attachment as an automatic Chapter IV 103 by-product of the message-passing paradigm defined e a r l i e r i n the chapter. The procedural attachment for objects other than i PEXPRs i s t r i v i a l (since the object body i s automatically the only procedure to attach); f o r JPEXPRs, however, things are more i n t e r e s t i n g . There are no e x p l i c i t procedures to attach, but any pattern which matches could contain procedures that need to be executed to achieve the match (servants). These same procedures can a r b i t r a r i l y assert or remove patterns as they proceed and thus i n d i r e c t l y invoice IF-ADDED or IF-REMOVED processing. Moreover, certain JC0ND= interrupts have e f f e c t s s i m i l a r to IF-ADDED methods i n that control i s shifted after the addition of a pattern; but t h i s i s a very constrained kind of demon which i n e f f e c t prevents uncontrolled sub-goaling rather than the usual uncontrolled, p o t e n t i a l l y explosive r o l e f o r demons. JLISP allows the attaching of a pattern in a variety of ways i f there i s n ' t a suitable pattern d i r e c t l y associated with a JPEXPR. The semantics of t h i s are precisely defined i n the section on the matcher, but the basic point i s that i t i s up to the object represented by the pattern head to decide what to do i n the case of such a f a i l u r e , be i t look i n t o the execution environment, the ISA environment, or whatever. This gives a f a i r l y general, knowledge-dependent way of attaching information (be i t procedural or declarative) to a JPEXPR. KRL also makes a commitment to multi-processing as a fundamental control paradigm. Details are not specified i n the Bobrow and Sinograd (1976) paper, but i t appears that processes Chapter IV 104 are co-operatively scheduled to run (much as are JPEXPRs i n (LISP) on an agenda (execute gueue) with a set of p r i o r i t i e s attached. Unlike the JLISP execute gueue, the agenda i s layered to give more f l e x i b i l i t y . KRL processes are capable of sharing a l i m i t e d resource pool with one another: how the pool i s incremented or decremented i s l e f t up to the processes sharing i t . In contrast, JLISP defines only a couple of "resources": time and conditions on what i s to be asserted i n sub-jPEXPRs, and these are c o n t r c l l e d by the interpreter or i t s sub-functions. The KRL approach has the advantage that a l o t of automatic processing i s l e f t out at the expense of added complexity for the users i f they are to keep track of resources. JLISP avoids t h i s complexity by r e s t r i c t i n g the whole problem of resource a l l o c a t i o n to a small set of useful features. It may turn out that resource a l l o c a t i o n has a far more serious and c r u c i a l role to play than |LISP suggests, but t h i s i s a question for the future. The concepts of messages and message passing have been most f u l l y elaborated by Hewitt in his many ACTOR papers (Hewitt et a l (1973), Hewitt and Greif (1974), Hewitt (1975)). Havens (1977) has implemented a frame system, MAYA, employing the basic idea of messages and message passing to good e f f e c t . At i t s most primitive l e v e l , the concept i s a simple one: each actor (or frame) i s an independent module which maintains i t s own representation of whatever knowledge i t deems to be important. The representation can only be accessed by sending the actor a message (which i s i t s e l f an actor), and i f the actor Chapter IV 105 then sees f i t , i t can respond by sending back a message. Conceptually, message passing d i f f e r s from procedure c a l l i n g i n that i t implies no top-down structure, but in e f f e c t allows any kind of top-down, bottom-up, or other scheme to be undertaken (a fact exploited e s p e c i a l l y by MAYA). This description comes f a i r l y close to describing the JLISP message passing scheme with the following exceptions: (i) messages are not objects, but are s-expressions or patterns; (ii) answers to messages are not messages, but are arbitr a r y s-expressions or patterns; ( i i i ) answers are guaranteed i f a message has been sent; that i s , continuations are not part of the message. (iv) a c tivation records ( i . e . execution instances) created by message passing have names and can be accessed. Although perhaps destroying the uniformity of the representation, such considerations are extremely useful and not at a l l r e s t r i c t i v e i f the purpose i s to model knowledge rather than to produce an elegant description of process and co n t r o l . Points ( i i i ) and (iv) are perhaps the most c r i t i c a l differences between Hewitt's approach and that of JLISP. By guaranteeing an answer, JLISP removes the incumbency on the sending object to set up a continuation, a s i m p l i f i c a t i o n achieved at the cost of some lack of control f l e x i b i l i t y . However, i t seems important that a super-goal always be reguired to evaluate the r e s u l t s of Chapter IV 106 i t s sub-goal, e s p e c i a l l y so i n the case of a f a i l u r e of some sort. As Sussman (1973) has pointed out, the returning of accurate error diagnostics i s c r u c i a l to i n t e l l i g e n t behaviour: i f nothing i s returned, no information can be used. (As an aside, t h i s kind of error processing f i l l s the r o l e i n JLISP of Minsky*s more declarative idea of a s i m i l a r i t y network.) I t should be noted, as well, that i f co-routining or i t e r a t i o n i s needed, i t i s r e l a t i v e l y easy to pop a JPEXPR stack and hence achieve a non-growing set of pushdown values. As to difference {iv), the naming of a c t i v a t i o n records allows JLISP to maintain a record of processing decisions, to be able to restart interrupted processes, and to otherwise manipulate i t s process activations. This i s useful i n many places, especially i n execution environment searches and episodic memory construction. 4*3 Other Approaches In t h i s (hopefully rather more abbreviated) section, several schemes that have not been as c r i t e r i a l to JLISP as frames and PLANNER / CONNIVER have been w i l l be compared on at l e a s t a few i n t e r e s t i n g dimensions with JLISP. Semantic network and procedural network issues are relevant, but have been dealt with during the discussion of frames., MERLIN (Moore and Newell (1973)) turns out to be quite important as well i n a couple of ways: i t s semantic network aspects (which have been covered); and i t s analogy aspects which w i l l be taken up in Chapter IV 107 Chapter VI. A f i n a l comparison w i l l be made to the production system approach. Production systems (Newell (1973)) were designed as a psychological model of human short term memory processing and have more recently been used i n a number of p r a c t i c a l applications (e.g. MYCIN ( S h o r t l i f f e (1976)). The aims of the approach don't r e a l l y have a l l that much in common with those of JLISP, but I couldn't help seeing s i m i l a r i t i e s between the "match > action" kind of control paradigm and the pattern matching of JLISP., S p e c i f i c a l l y a pattern of the form (ANYTHING ! ( — - ) ) Seems to e s s e n t i a l l y encode the same information as a production might {JLISP's "productions", of course, can have n elements and more complex kinds of processing within them). I f t h i s analogy were carried out further, then a J PEXPR would be a group of productions and hence a production system. Since there are many |PEXPBs, there would be an entire c o l l e c t i o n of such production systems within the model. The only thing I can't f i t i n very well i s short term memory, an aspect c e n t r a l to production systems but peripheral to ray main concerns. However, i t i s encouraging that a control paradigm s i m i l a r i n some ways to that of JLISP has been so successful i n various applications. I t gives hope for the ultimate f e a s i b i l i t y of JLISP for actual use i n the " r e a l world". Chapter IV 108 .4.4 Contributions to the Issues I would now l i k e to examine the representation scheme i n l i g h t of the issues which i t was supposed to treat (see issues (i)-R through (vi)-R i n section 1.3). (i) handling procedural and declarative information: Pattern expressions contribute to the merging of declarative and procedural information. For JPEXPRs there i s no d i s t i n c t i o n between a procedural JPEXPR body and a separate declarative data base. Instead, a l l information, procedural or declarative, i s stored i n patterns within the body of the JPEXPR. Moreover, such information i s accessed i n a uniform way via pattern matching. The procedural / declarative difference merges s t i l l further when i t i s rea l i z e d that after a message pattern has been processed, the matching pattern (now with no macros l e f t ) t h a t has been used to answer a message pattern i s asserted i n the body of the execution instance. I f that execution instance i s ever sent the same message pattern again, then the resu l t i s already there, pre-computed. However, the drawback here i s two-fold: f i r s t , messages aren't usually sent to execution instances; and second, things may have changed s u f f i c i e n t l y that macros i n the message pattern could compute something d i f f e r e n t l a t e r . This a b i l i t y does i l l u s t r a t e , though, a certain nice point about declarative patterns: they are often just the residue of patterns containing procedures and hence cl o s e l y connect procedures and data. Chapter IV 109 ( i i ) the problem of accessing knowledge: The scheme presented here has several int e r e s t i n g aspects involving the accessing of information. Information i s only accessed when some object wants some other object to answer a message (since the only i n t e r e s t i n g objects are IPEXPRs, the r e s t of the discussion w i l l centre on them). In t r y i n g to respond to a message, a receiving JPEXPR has a couple of options: i t can know the answer d i r e c t l y ( i . e . i t has a pattern in i t s body that contains the answer) or i t may need to look elsewhere for an answer, in which case a strategy i s followed that depends on the kind of information being sought. Thus, a search along very s p e c i f i c " l i n k s " emanating from the |PEXPB can be i n s t i t u t e d (allowing inheritance up "ISA" l i n k s for example), or an a r b i t r a r y inferencing scheme can be entered into involving much thrashing about, or the user can be asked to help out, or any number of other things can be attempted. Even i f the |PEXPR does know the answer, i t may need to perform a number of procedural duties before providing i t . In so doing i t can send out other messages using a variety of control paradigms ranging from the ordinary s e r i a l processing to f u l l scale simulated parallelism. ( i i i ) the necessity for a context mechanism: The nature of context i s rather more complex than has been suggested at several places during the chapter. It has to do with deciding what things are relevant at any time; the nature of t h i s decision-making process must await the examples of Chapter IV 1 1 0 Chapter V to be more f u l l y understood. Here, i t i s enough to know that J LISP has b u i l t into i t a couple of assumptions that are very useful f o r contextual considerations. There i s the observation that a l l objects are closed u n t i l sent a message. This e f f e c t i v e l y makes an object i n v i s i b l e except to other objects which know about i t e x p l i c i t l y by name or who can discover i t s name by some sort of inferencing. The major contribution to context, however, i s the execution environment which extends up EX-ENVIRON pointers from any execution instance. The execution environment can be accessed whenever contextually varying information such as purpose, location of r e a l world objects, current time, etc. i s needed. {iv) the need to keep a record of events: Execution environments are also useful in providing an episodic memory, not only because they don't disappear after they are complete, but also because they are examinable in the same way as other JPEXPR environments. The f i r s t c a p a b i l i t y means that a l l the execution instances which completed in the past s t i l l are there to be gueried as to who c a l l e d them, why they were c a l l e d , what they answered to the act i v a t i o n message patterns, what j PEXPR they are an execution instance of, and so on, almost as i f they were s t i l l i n the active execution stream. I t also has space l i m i t a t i o n drawbacks which are explicated below. The second c a p a b i l i t y i s a by-product of having execution instances with meaningful patterns rather than uninterpretable i n t e r n a l pointers. It means that a l l the Chapter IV 111 matching routines which work for ordinary JPEXPRs can also be used for execution instances and that searching old execution environments i s as natural as searching anywhere else. (v) robustness: An interesting issue i s that of robustness: how the system can be designed so i t doesn't choke on the f i r s t abnormal morsel which comes i t s way. Although the scheme's c a p a b i l i t i e s i n t h i s regard are as yet poorly developed, JLISP i s even now capable of f a i l u r e to match processing i f a pattern i s n ' t d i r e c t l y matchable i n a JPEXPR. In addition, since messages are guaranteed to get an answer, a sending JPEXPR can plan on getting a f a i l u r e response of some sort i f the receiving JPEXPR i s unable to handle the message. With this response, the sender should be able to take appropriate action. However, even though the machinery has been provided to handle them, v i r t u a l l y no analysis has gone into the nature of f a i l u r e responses. (vi) combinatorial explosion v.s. complexity: jPEXPRs are chameleons which can be viewed i n di f f e r e n t ways i f i t i s convenient to do so. This f l e x i b i l i t y goes some way towards helping to resolve the combinatorial explosion / complexity barrier dilemma. For instance, when a JPEXPR i s looked at as a node i n a network, then only c e r t a i n nearby objects can be "seen", thus f a c i l i t a t i n g the l i m i t a t i o n of search and hence addressing the problem of combinatorial explosion. Of particular interest here are objects i n the Chapter IV 112 execution environment, the primary means of focussing attention. The a b i l i t y to draw "pictures" with IPEXPRs as nodes, surrounded by arcs, adds to the perspicuity of the system. But, usually of even more help in resolving complexity issues i s the f a c t that IPEXPRs can also be considered as separate modules accessible only via t h e i r messages. Such s e p a r a b i l i t y i s extremely valuable in l o c a l i z i n g e f f e c t s , and also i n dividing up the domain int o comprehensible chunks (moreover, JPEXPRs are f l e x i b l e enough that they don't impose many r e s t r i c t i o n s on how to break down world knowledge). To be sure, the representation scheme leaves much to be done on t h i s issue, e s p e c i a l l y i n providing so l i t t l e d i r e c t i o n as to how to break down world knowledge, but i t i s a s t a r t . flany of the other non-central issues raised i n the introduction also can be helped (at l e a s t potentially) by t h i s approach. For example, the issue of non-goal-directed processing: while i t i s true that most of the examples of Chapter V involve top-down activation i n that a J PEXPR sends a message to another JPEXPR i n order to achieve a sub-goal, t h i s i s an external interpretation put on the message by humans. To JLISP i t i s just a message, indistinguishable (in how they are handled) from messages that achieve associative activation (see Chapter VI) or messages that allow a set of words to be conglomerated bottom-up into a single phrase or any other kinds of messages. The point i s that because JPEXPRs can have a variety of patterns attached to them they can respond to a Chapter IV 113 variety of d i f f e r e n t messages. Moreover, since execution instances stay around for awhile after creation, i t i s possible for several messages to communicate to one pattern expression as well as vice versa. This can be e s s e n t i a l for bottom-up or associative activation when i t i s often important that several messages from d i f f e r e n t sources be sent before the receiving J PEXPR i s considered to be relevant. Thus, i t can be seen that jLISP defines a message passing paradigm that i n i t s e l f i s neither bottom-up nor top-down, but that allows both (or anything else f o r that matter). In conclusion, the major contribution of JLISP i s perhaps the confluence of ideas i n one place. Even though the l a s t section has shown that many of the ideas derive from other approaches, I think that putting them a l l together i s a useful thing i n i t s e l f i n that the ideas take on a new perspective when viewed i n the context of one another. This perspective helps to illuminate some aspects of them which might otherwise remain obscure. Before heading into a detailed example of the representation scheme being applied to the modelling of conversation, I would l i k e to suggest how the scheme helps i n the language issues mentioned i n section 1.2 and in Chapter I I . Both l i n g u i s t i c and n o n - l i n g u i s t i c knowledge can be encoded i n jPEXPRs, hence e f f e c t i v e l y combining the two i n t o one view (issue ( i ) - L ) . These JPEXPRs send messages to one another to achieve goals (further blurring the d i s t i n c t i o n between world and l i n g u i s t i c knowledge), and the resultant execution Chapter IV 114 environment allows not only the discovery of current goals (issue ( i i ) - L ) , but also the a b i l i t y to focus only on certain relevant things (issue ( i v ) - L ) . Conversant models, themselves JPEXPBs, are pointed to from execution instances of the main goals, and can be used to help i n the l i n g u i s t i c endeavour (issue ( i i i ) - L ) . The contribution that the representation scheme makes to conversation w i l l become clearer as the next chapter (Chapter V) i s read. In i t , a particular conversation scenario i s delineated, and a model to handle several conversations i n t h i s scenario i s discussed in d e t a i l . Chapter IV 115 CHAPTER V Modelling Conversation: A Detailed Example In this chapter I would l i k e to show the representation scheme being applied to the analysis of conversation., Modelled i s an active participant carrying out a (simulated) plan of attending a symphony concert. During execution of the plan, the model, among other things, engages in several conversations, including one to buy a t i c k e t to the concert, another to buy a drink at intermission, and one with a fr i e n d to "pass the time". Before going into more d e t a i l , i t would be i n s t r u c t i v e to outline why I f e e l that the representation would help i n the modelling of conversation. F i r s t there i s the basic modularity of |LISP'S structures which enables concepts to be studied independently while s t i l l maintaining cer t a i n l i n e s of communication between them,, Such separation can be domain dependent rather than representation dependent, thus allowing the natural d i v i s i o n s of the domain to be followed i n choosing modules. |LISP also has constructs which help to solve language problems. Thus, pattern expressions are well suited to representing deep case frames, plans, models of the conversants, or i n fact almost any knowledge. The execution environment i s useful i n providing the foregrounding necessary to keep i n hand a l l the information f l o a t i n g around i n a conversation. Chapter V 1 1 6 Self-examinable old execution environments allow f o r episodic memory, necessary for scanning old conversations or old parts of the current conversation. An additional advantage which JLISP gives for such considerations i s that often one construct solves several representational problems at once. Thus, for example, pattern expressions encode many d i f f e r e n t kinds of knowledge i n one structure; moreover, viewing pattern expressions as nodes in a semantic network allows processing that turns out to be useful f o r reference resolution, contextual processing, and h i e r a r c h i c a l storage of information, among other things. a f i n a l j u s t i f i c a t i o n for both the use of JLISP (and for the study of conversation i t s e l f ) i s that I've made many s i m p l i f i c a t i o n s i n the analysis. Thus, many pattern expressions contain only the basic information needed to give a crude approximation to the behaviour desired at a stage; i n f a c t , some JPEXPRs are just names with no structure at a l l as yet. Surface-level language i s n ' t emphasized too strongly (although I f e e l i t i s important to at least show how such processing could be integrated into the system), nor are many other p o t e n t i a l l y relevant language issues. Neither economy of representation nor e f f i c i e n c y of execution are considered to be too important. Thus, the searches aren't, perhaps, as f i n e l y tuned as they could be: certain subgoals may be t r i e d that wouldn't be i f a more complete analysis were done, certain IPEXPRs may be combined into s i n g l e , more elegant IPEXPRs, and so on., This i s not to say that I haven't been economical and e f f i c i e n t wherever Chapter V 117 possible; just that i t hasn't been a major consideration so I've not t r i e d a l l that f i e r c e l y . There are, of course, generalizable features (some of which I talk about here and also i n Chapter VI), but what I have been primarily concerned with i s i n d i c a t i n g the basic nature of the int e r a c t i o n s that must go on, and showing how the kind of analysis described here might eventually be extended to a more sophisticated model for conversation. F i n a l l y , i t should be noted that none of the pseudo-code outlined here has been debugged. Many functions are just "stubs" i n the sense that t h e i r I/O behaviour has been delineated but no more elaborate version i s available. Although, naturally, "hard" code would be nice, the examples c e r t a i n l y show to a f a i r amount of d e t a i l the kinds of points I have i n mind. The chapter i s organized along these l i n e s : f i r s t , an environment i n which to study conversation (called the concert scenario) i s described. This i s followed by a b r i e f overview of how t h i s scenario has been modelled i n JLISP. The model i t s e l f i s then presented i n d e t a i l i n terms of the goals i t undertakes to handle a dialogue to buy a t i c k e t . Higher l e v e l n o n - l i n g u i s t i c goals are described f i r s t , followed by s c r i p t s , speech acts, and the language l e v e l . F i n a l l y , the two other dialogues the model undertakes, one with a bartender and one with a f r i e n d , are discussed very b r i e f l y . Chapter V 118 5-1 The Concert Scenario lather than attempt a f u l l scale analysis of arb i t r a r y conversations, I have limited the study to a single small scenario in which a model undertakes conversations that might occur during attendance at a symphony concert. In these conversations the model takes an active r o l e ( i . e . i s one of the conversants), hence forcing i t to have a goal oriented viewpoint on events. Before giving more de t a i l s about the scenario, I would l i k e to indicate some of the general reasons for choosing i t . The "concert scenario" has been chosen because i t i s f l e x i b l e and complex enough to provide a r e a l test for the model and to i l l u s t r a t e most of the representation and language issues, yet i t i s of very f i n i t e dimensions. Moreover, various kinds of dialogue can occur including task-oriented (see Deutsch (1975)), non-task-oriented, formal, informal, etc.; n o n - l i n g u i s t i c goals occur and interac t with the l i n g u i s t i c goals; and, f i n a l l y , having a single scenario allows a small amount of information to be used i n several, possibly guite different, s e ttings. The scenario i s e s s e n t i a l l y t h i s : the model i s " s i t t i n g " at home and decides to take i n a concert at the Queen Elizabeth theatre. I t Ci) leaves home (ii ) goes to the Queen Elizabeth theatre ( i i i ) buys a t i c k e t to the concert (iv) enters the theatre (v) takes i n the f i r s t half of the concert Chapter V 119 (vi) buys a drink at the bar at intermission (vii) drinks i t ( v i i i ) unexpectedly meets a frie n d (ix) takes in the second half of the concert and (x) goes home. , Three conversations occur: during step ( i i i ) when the model must talk with the ti c k e t s e l l e r i n order to purchase a t i c k e t to the concert; during step (vi) when the model talks with the bartender in order to buy a drink; and during step ( v i i i ) when the model talks to the fr i e n d . These are the c r i t i c a l steps singled out for treatment in some d e t a i l ; the other steps are only examined at a very cursory l e v e l , and are included mainly to show continuity i n the plan and to indicate the interaction of l i n g u i s t i c and non-^linguistic goals. I w i l l now present sample dialogues which might actually occur i n such a s i t u a t i o n . I have made them up, but my informal analysis of s i m i l a r situations convinces me that they are not u n r e a l i s t i c . They have served as a guide to the kinds of things that the model must allow for, but many of the phenomena ( l i n g u i s t i c and otherwise) that occur in them have not been f u l l y accounted for i n t h i s version of the model. Conversation _1 This conversation occurs when the model buys a ticket to the concert. T i c k e t - s e l l e r : "Yes?" Chapter V 120 Model: "I'd l i k e a t i c k e t to the concert." T i c k e t - s e l l e r : "How about K-5? I t i s right centre about 10 rows back." Model: "Fine., How much i s that?" T i c k e t - s e l l e r : "10 d o l l a r s . " Model: "O.K." (forks over the money) T i c k e t - s e l l e r : (forks over the ticket) Model: "Thanks." T i c k e t - s e l l e r : "Thank you s i r . " This somewhat innocuous conversation i l l u s t r a t e s a number of inte r e s t i n g things. F i r s t , i t i s a task-oriented dialogue i n the sense that i t i s entered into to achieve some rather s p e c i f i c goal ( i . e . to get a t i c k e t to the concert). Moreover, the task i s a common one, well understood by most people, so there i s a very well defined s c r i p t that can d i r e c t the conversation without fear of much i n the way of unexpected input. The s c r i p t c l e a r l y must be able to handle a l l the bargaining and exchange components underlying the conversation, to smoothly enter the conversation and just as smoothly terminate i t , to discover the purpose for the conversation (when asked "Yes?"), and to interleave non-linguistic actions (forking over the money or tickets) with the l i n g u i s t i c utterances. Conversant models must be kept for both the t i c k e t s e l l e r and the model so that the minimal surface utterances seen here can be devised (after seeing what knowledge i s stored there) and so that politeness marker's ("sir") can be attached appropriate to the r e l a t i v e status of the conversants. As in a l l these Chapter V 121 conversations, conversation 1 must be properly integrated into the general plan of the model. This conversation has been f a i r l y completely studied i n terms of what knowledge is needed to properly undertake i t , how that knowledge can be represented, and how i t interacts to y i e l d a proper sequence of surface utterances. Later i n the chapter i t i s discussed from the highest lev e l s right down to how i t handles surface l e v e l input / output. However, because the analysis i s general enough to handle many conversations of t h i s type, the actual surface utterances suggested by the analysis would d i f f e r somewhat from those shown here. Conversation 2 This dialogue takes place af the bar in the lobby when the model decides to obtain a drink. Bartender: " S i r ? " Model: "Could I have a rye?" Bartender: "On the rocks?" Model: "Please.'? Bartender: "There you go." (produces drink) " T h a t ' l l be $1.50 please." Model: (produces 2 do l l a r b i l l ) Bartender: "Thank you s i r . " (produces 50 cents change) Model: "Thanks." This conversation i s almost a duplicate of the f i r s t one i n i t s interesting features. The main reason for including i t i s Chapter V 122 to t r y to show that the analysis proposed for conversation 1 i s n ' t t o t a l l y " t i c k e t s p e c i f i c " . In f a c t , a l l the main structures proposed for conversation 1 can also be used f o r conversation 2, the only difference being that cert a i n kinds of tic k e t information are replaced by si m i l a r kinds of drink information {i.e. the information about the product being bought i s now appropriate to drinks not t i c k e t s , the conversant i s now a bartender not a t i c k e t s e l l e r , the model's purpose i s to buy a drink not a t i c k e t , etc.) The conversation i s discussed b r i e f l y i n the same terms as conversation 1, and i s shown to be handled i n a similar manner. The subtle features which make the surface language dif f e r e n t are not at a l l dealt with. Conversation 3 This conversation i s entered into by the model when i t unexpectedly meets a "f r i e n d " , Jack, at intermission. Model: "Hi Jack." Jack: "Model! What's new?" Model: "Not much. I didn't know you came to these things. Do you have season t i c k e t s ? " Jack: "No - but I couldn't miss th i s one. I r e a l l y want to hear the Mozart concerto." Model: "I came mostly for the Bartok myself. And I can't say I was disappointed by the f i r s t half. The orchestra played superbly, don't you think?" Jack: "Frankly, I was bored. Don't much l i k e Bartok r e a l l y , or any other 20th century composer." Model: "Well, I f e e l the same way about Mozart. I'm usually bored to tears by his s t u f f . S t i l l the B- f l a t i s n ' t bad so maybe I ' l l stay awake f o r a change." Chapter V 123 Jack: "There goes the buzzer. I'd best get back to my seat." Model: "Good to see you again. We'll have to get together sometime for a beer." Jack: "Sure thing. See you soon." Model: "Take care." This conversation i l l u s t r a t e s several features not encountered i n conversations 1 and 2. For one thing, i t i s n ' t task-oriented; that i s , there i s no e x p l i c i t , detailed goal the model has for taking part in the conversation., The model has more general goals such as f i l l i n g i n time, being s o c i a l l y gregarious, trying to win support for i t s views or to argue against those of Jack. Because there i s a much looser structure to what the model i s doing here, the general s c r i p t overseeing the discussion i s of necessity much less well informed i n a d i r e c t sense. Instead, i t must make many inferences based on p a r t i a l information, must make good use of the b e l i e f models of i t s e l f and Jack, must be f l e x i b l e and ready for unexpected information, and so on. This conversation i s in t e r e s t i n g , as well, in that i t i s n ' t undertaken as part of any pre-determined plan, but i s started as the r e s u l t of unexpectedly meeting Jack. The plan i n control at that time would have to explain the unrehearsed a r r i v a l of Jack and suggest ways of r e c t i f y i n g the (to i t ) anomaly of his presence. Hopefully, such r e c t i f i c a t i o n would involve the act i v a t i o n of an appropriate s c r i p t to d i r e c t the conversation. Moreover, the conversation i s n ' t terminated as part of a plan Chapter V 124 either (i.e. the buzzer sounds) and this would have to be accounted for as well. The conversation also has a much more serious need f o r surface l e v e l l i n g u i s t i c analysis than do the other two, The utterances are longer, more complex, and more informal. The reference problems (especially pronoun reference) are more subtle and quite d i f f i c u l t (e.g. " t h i s one" i n the fourth utterance). Special l i n g u i s t i c forms ("the Bartok", "the B-flat") peculiar to c l a s s i c a l music further complicate matters. The sequencing order i s much more poorly defined here, presenting problems even at the l e v e l of deciding when to int e r p r e t and when to produce utterances, whether to interrupt a long winded discourse, etc. Several well defined s c r i p t s (for greeting and closing, at least) could be integrated at the appropriate time i f the s c r i p t were a l e r t to bottom-up cues, an integration which would save much processing time since utterances could be much more easily understood and produced by these s c r i p t s . This conversation also i l l u s t r a t e s the need f o r an episodic c a p a b i l i t y . Questions about the f i r s t half of the concert would reguire the model to scan over episodes representing what occurred at that time and extract what seemed relevant. Most of the things conversation 3 i l l u s t r a t e s have not been analyzed although a preliminary stab has been made at some aspects. The conversation has been included mainly to suggest the vast amount that s t i l l needs to be done. Chapter V 125 So, t h i s i s the scenario. For the remainder of the chapter, I would l i k e to analyze i t i n terms of JLISP. 5.-2 Overview of the Model Most important pieces of knowledge needed by the model in i t s task of buying a t i c k e t to the concert are encoded as pattern expressions. To handle the concert scenario, I see the necessity for two main categories of JPEXPR: (i) primary pattern expressions to carry out parts of the main plan of attending a concert including going to the concert, buying a t i c k e t , taking part i n a conversation during the t i c k e t purchase, and so on. (ii ) secondary pattern expressions, such as those representing models of the conversant, the agenda of the concert, and the l i k e , that are sources of information for the primary IPEXPRs but aren't r e a l l y part of the mainstream plan. The d i s t i n c t i o n between (i) and (ii) can be seen as the difference between active objects c a l l i n g i n other active objects to accomplish subgoals and s t a t i c objects standing by to provide certain pieces of "foregrounded" knowledge when asked to do so by the active objects. The d i v i s i o n i s not, of course, absolute in that primary JPEXPRs can ask one another for information without r e a l l y giving up control; and secondary JPEXPRs can be activated as "temporary" subgoals when they are asked guestions by primary JPEXPRs or each other. Some of the primary pattern expressions used by the model Chapter V 126 to handle a portion of the conversation to buy a t i c k e t are shown i n Figure 5.1 which outlines i n graphic form the object sub-object goal dependencies that are important i n understanding the capsules. These JPEXPRs are defined as follows: (i) TOP-VIEW: overlord to the system; a l t e r n a t i v e l y c a l l s i n sub-objects META-VIEW and WORLD-VIEW. (ii ) BETA-VIEW: the system's " i n t e l l i g e n t " garbage c o l l e c t o r ; responsible f o r overseeing a l l clean-up operations on the system's structures. ( i i i ) WORLD-VIEW: es s e n t i a l l y the "consciousness" of the system. Must co-ordinate, at the highest l e v e l s , the goals of the system; must decide what subgoals to achieve when and for what reasons. (iv) ATTEND-CONCERT: the |PEXPR that di r e c t s the model's e f f o r t s to attend t h i s p a r t i c u l a r concert. Conceptually, at le a s t , i t has been b u i l t by some plan- cons tr uct ion objects at the request of WORLD—VIEW when i t decided that attendance at the concert would be a good idea. It must achieve the many subgoals necessary to accomplish t h i s goal. The major three of importance for conversation are buying a t i c k e t , buying a drink, and f i l l i n g i n time at intermission. (v) BUY: the model's pattern expression to di r e c t the buying of something. In t h i s case ATTEN D-CONCERT suggests buying a t i c k e t to the concert and l a t e r c a l l s BUY again to suggest buying a drink. BUY i s an oversimplified attempt to model what goes on in buying something. It must di r e c t the Chapter V 127 BUY (ticket) TOP-LEVEL META-VIEW WORLD-VIEW ATTEND-CONCERT I BUY (drink) BUY-CONVERSATION" WHAT-DO-YOU-WANT INQUIRE \ YES2 —7 FILL-IN-.. TIME RESPOND Figure 5_. 1 -The Dynamic Linkages of Some Concert Scenario IPEXPRs 128 model t o the place of purchase, must r e c o g n i z e the p a r t i c u l a r s e l l e r o f the item, must access JPEXPRs which represent v a r i o u s b a r g a i n i n g p o s i t i o n s of the two p a r t i e s to the buying, and f i n a l l y must engage i n a c o n v e r s a t i o n t o e f f e c t the purchase. (vi) BUY-CONVERSATION: i s the s c r i p t t h a t c o n t r o l s a c o n v e r s a t i o n t o b a r g a i n f o r the exchange of one se t of goods f o r another; i n t h i s case the exchange i s between the money of the model and the t i c k e t o f the t i c k e t s e l l e r . The pa t t e r n e x p r e s s i o n p r e d i c t s the c o n v e r s a t i o n a l sequence o f events from the g r e e t i n g s which open the c o n v e r s a t i o n , through b a r g a i n i n g over the l o c a t i o n o f the t i c k e t , b a r g a i n i n g over the p r i c e , and f i n a l l y ending with the exchange of the agreed upon goods and the making of accompanying comments. Each of these p r e d i c t i o n s takes the form of c a l l i n g i n a s u b - s c r i p t t o d i r e c t the pr o c e s s i n g . The f i r s t i s r a t h e r p o e t i c a l l y named 8HAT-D0—YOU-WANT. ( v i i ) WHAT-DO-YOU-WANT: a s c r i p t t h a t knows about the kind o f language that accompanies a c o n v e r s a t i o n a l exchange where one person asks another what he wants ( i . e . h i s purpose). The s c r i p t i s invoked i n t h i s case by the EXCHANGE—CONVERSATION 1PEXPR t o handle the f i r s t couple of u t t e r a n c e s i n the c o n v e r s a t i o n to buy a t i c k e t . , I t expects the t i c k e t s e l l e r to i n g u i r e i n t o the purposes of the model; and expects the model to respond a p p r o p r i a t e l y to t h i s i n q u i r y . ( v i i i ) INQUIRE: a speech act which w i l l e i t h e r understand or produce an " i n q u i r e " u t t e r a n c e , depending on whether the model i s l i s t e n i n g or speaking. In the c u r r e n t example, the Chapter V 129 WHAT-DO-Y00-WANT pattern expression expects the t i c k e t s e l l e r to utter an inguiry into the purpose of the model, so inquire i s activated to understand such an utterance. Achieving t h i s i n t e r p r e t a t i o n reguires the jPEXPR to look into the input buffer for words which have actually been uttered. Discovering the word "yes", i t checks to see i f there i s a speech-act associated with the word "yes?" which could be construed as an inquiry. Finding that there i s <YES2), INQUIRE i s supplanted by YES2 which continues the processing (since the actual input should take precedence over any expectation). (ix) YES2: represents the meaning of "yes" that corresponds to an inquiry (rather than the meaning "affirmative answer"). I t i s c a l l e d i n to continue the process of understanding the input. Since "yes?" i s a surface s t r i n g that i s consonant with the knowledge of YES2, YES2 i s able to achieve the proper interpretation that the utterance i s an inguiry i n t o the current purpose of the model (available i n the execution environment). I t then returns, s a t i s f i e d , to i t s c a l l i n g JPEXPR. WHAT-DO-YOU-WANT regains co n t r o l ; sees that the f i r s t utterance i s just about as expected ( i f i t weren't, WHAT—DO-YOU—WANT would have had to explain what went wrong); t i e s i t into the conversation to date, being kept track of i n the s c r i p t ; and then proceeds to the second s c r i p t utterance, the qeneration of a response to the inquiry. Before handling the next s c r i p t utterance, however, WHAT-DO-YOU-WANT must f i r s t decide i f something i n the conversation to date i s demanding p r i o r i t y over i t s s c r i p t expectations, and i f so, what to do Chapter V 130 about i t . In t h i s case an analysis of the conversation to date suggests only that the unknown purpose of the f i r s t utterance should be discovered and, since t h i s i s in accord with the second s c r i p t utterance, everything i s i n order. (x) RESPOND: contains the model's ideas about responding to a guery, including how to interpret or generate a response. Since WHAT-DO—YOU-WANT orders RESPOND to generate an utterance s t a t i n g the purpose of the model, i t does so, sending the resultant set of words {e.g. "I'd l i k e a ti c k e t to the concert.") to the EXPR SPEAK-WORDS. Clearly a whole l o t of other objects have been c a l l e d on here to decide such things as how much semantic information w i l l get across the purpose of the model to the t i c k e t s e l l e r (which involves, at lea s t , looking at the b e l i e f s of the conversant and of the model i t s e l f , and searching into the execution environment) ; how to phrase the eventual output; what words to choose; how to order them; and so on. These issues aren't treated to any great extent: I'm content at t h i s stage that the system knows generally what to say and don't r e a l l y care i f i t says i t well. Once RESPOND i s done, i t returns again to WHAT-DO-YGU-WANT which must check that the utterance produced i s appropriate, t i e i t in to the conversation to date, and then proceed to the next s c r i p t utterance. But, since the s c r i p t i s now complete, WHAT-DO—YOU-WANT returns to the EXCHANGE-CONVERSATION s c r i p t which, i f s a t i s f i e d with i t s behaviour, t i e s the WHAT-DO-YOU-WANT utterances into i t s conception of the conversation to date. I t then proceeds to the bargaining Chapter V 131 s c r i p t s which carry on. Eventually, even the EXCHANGE-CONVERSATION pattern expression i s done, so i t returns to BOY, which, when finished, goes back to ATTEND-CONCEBT to continue with the plan of attending the concert. Among other things, two more conversations w i l l be undertaken before the A TTEND-CONCEBT JPEXPR i s s a t i s f i e d , and these w i l l be handled i n much the same way as the ticket buying conversation has been. Once ATTEND-CONCERT i s done, WORLD-VIEW takes over to ponder what to do next. I t should be mentioned that working i n p a r a l l e l to WORLD-VIEW i s BETA-VIEW whose job i s to clean up the large number of execution instances and other miscellany constructed as the r e s u l t of a l l the JPEXPR message passing that has gone on during the reign of WORLD-VIEW; to move things i n common amongst groups of sub-JPEXPRs up into t h e i r ISA environment i f this seems appropriate; to check for useful analogies; to synthesize p o t e n t i a l l y useful plans that can be employed i n the future; and the l i k e . None of these issues have been investigated. This has been a br i e f look at some of the many action-packed primary pattern expressions i n the concert scenario. But, these JPEXPRs need to access l o t s of data contained i n other, secondary pattern expressions. Secondary J PEXPRs, acting mainly as receptacles of knowledge, are guite passive i n their behaviour. The important connections to other J PEXPRs are not the dynamic ac t i v a t i o n l i n k s useful to primary pattern expressions, but are rather the more s t a t i c semantic network type l i n k s of t h e i r patterns. Chapter V 132 For any p a r t i c u l a r s e t of primary goals, a c e r t a i n c o l l e c t i o n of secondary JPEXPRs i s needed, c o n s t i t u t i n g i n a sense, the foregrounded i n f o r m a t i o n f o r the p r i m a r i e s . The re l e v a n c e of each i s discove r e d at v a r i o u s p o i n t s d u r i n g the ex e c u t i o n of the primary planning sequence, and p o i n t e r s from these primary JPEXPRs are s e t up to r e c o r d the rel e v a n c e of the v a r i o u s s e c o n d a r i e s t o the main stream c o n t e x t . Then, l a t e r , o ther JPEXPRs can access the secondary JPEXPBs v i a these l i n k s , and hence share i n t h e i r knowledge. N a t u r a l l y , when a secondary JPEXPR i s asked about i t s views on some p a r t i c u l a r s u b j e c t , i t becomes ( f o r the moment) a p a r t o f the plan and hence t e m p o r a r i l y a s o r t of primary JPEXPR. But, the k i n d s of gues t i o n s i t i s asked are so t r i v i a l ( u s u a l l y i n v o l v i n g a simple match f o r a pi e c e o f d a t a ) , t h a t the secondary cannot r e a l l y be c o n s i d e r e d t o be ex e c u t i n g a subgoal i n the same sense as, say, ATTEND-CONCERT does f o r WORLD-VIEW. So, l e t s look at some of the secondary p a t t e r n e x p r e s s i o n s t h a t have proven u s e f u l i n the co n c e r t s c e n a r i o . The f i r s t such JPEXPR to be needed i s the CONCERT1 JPEXPR, c o n t a i n i n g a l l the model's knowledge about t h i s p a r t i c u l a r concert such as the agenda, the l o c a t i o n of the c o n c e r t , the entrance requirements. I t has been b u i l t sometime i n the past (whenever the model d i s c o v e r e d t h a t the c o n c e r t was t o be performed and heard the d e t a i l s of the agenda), and has been r e - d i s c o v e r e d by some planning JPEXPB spawned by WORLD-VIEW to c o n s t r u c t the plan t o go to t h i s c o n c e r t . I t i s passed by WORLD-VIEW as part o f the message that a c t i v a t e s ATTEND-CONCERT and i s used e x t e n s i v e l y i n Chapter V 133 further sub-JPEXPRs {especially i n retr i e v i n g c h a r a c t e r i s t i c s of the t i c k e t to the concert and i n discovering the agenda). Another secondary pattern expression, the TIC KET—FOR-CONCERT1 JPEXPR (a new instance of the generic TICKET-FOR-CONCERT) i s generated by ATTEND-CONCERT when i t i s about to BOY the t i c k e t . , I t i n h e r i t s from TICKET-FOR-CONCERT knowledge that the physical location of the t i c k e t i s i n the t i c k e t booth at the Queen Elizabeth theatre, the desired lo c a t i o n represented by the t i c k e t , and the projected cost f o r such a location, and looks further into the ISA environment to TICKET for information that a TICKET-SELLER s e l l s t i c k e t s . Later, once actual c h a r a c t e r i s t i c s (location, cost, etc.) of the t i c k e t have been determined (by the BARGAIN sub-goal of BOY-CONVERSATION) , they are added to TICKET-F OR-CONCERT1. , Perhaps the most important secondary pattern expression i s TICKET—SELLER1, f i r s t created as a new instance of the generic TICKET-SELLER by the BOY subgoal when i t recognizes the existence of a pa r t i c u l a r person in the t i c k e t booth. BUY knows that the person i s a TICKET-SELLER because TICKET-FOR-CONCERT1 t e l l s i t so. TICKET-SELLER1 constitutes the model's model of the conversant. I t i n i t i a l l y contains only the knowledge that i t i s a TICKET-SELLER, but via i t s INSTANCE-0F l i n k i t i s able to i n h e r i t much information from i t s ISA environment. In pa r t i c u l a r the immediately superior TICKET-SELLER contains information about t i c k e t s e l l e r s : that they s e l l t i c k e t s , that they're w i l l i n g to exchange tick e t s for an appropriate amount of money, that they are s e l l e r s , and so on. This information i s of Chapter V 134 much use later on when various bargaining positions must be discovered. Moreover, a t r u l y complete TICKET-SELLER would contain l o t s of information about speaking habits, probable locations, potential s c r i p t s , etc. • And as time goes on, more and more c h a r a c t e r i s t i c s of TICKET-SELLER 1 are added to give i t an ever more accurate view of the conversant. A f i n a l note: the model also has a model of i t s e l f , the d e t a i l s of which w i l l be explained l a t e r . This gives a guick overview of the various c a p a b i l i t i e s of the model i n the concert domain. Because of the i n t e r r e l a t e d nature of the processing, i t i s somewhat d i f f i c u l t to describe the scenario i n d e t a i l while s t i l l leaving some fe e l i n g f o r the global picture. Thus, rather than following each message as i t i s dispatched, in general I plan to take the approach of describing each pattern expression f a i r l y completely before going on to other objects. The order of description i s b a s i c a l l y breadth-first and i s shown i n Figure 5.2. Chapter V 1 3 5 Non-linguistic Goals: TOP-VIEW META-VIEW WORLD-VIEW ATTE ND-CON CERT BUY Scripts : BUY-CONVERSATION WHAT-DO-YOU-WANT BARGAIN EXCHANGE FAREWELL Speech Acts: INQUIRE YES2 Language Level Goals: UTTERANCE CLAUSE NOUNG VERBG PREPG Figure 5.2 - Order of Presentation 5.3 Non-linguistic Goals 5.3.1 The Highest Goals At the highest l e v e l s the model i s not concerned with language at a l l , but i s instead interested in co-ordinating i t s various non-rlinguistic goals. Of necessity these goals have been d r a s t i c a l l y oversimplified i n th i s presentation so as to give an idea of how they might relate to one another and to language without going into the obviously large complexities of representing sophisticated non-linguistic goals. Chapter V 136 The top-most goal i n the system i s TOP-VIEW whose main purpose i s to c o - o r d i n a t e the garbage c o l l e c t o r and the other a c t i o n s of the model, I t i s c a l l e d i n at system i n i t i a t i o n by sending i t (EXECUTE TOP-VIEW ?MATCH—PROGRAM), a message which w i l l match TOP-VIEW's (EXECUTE TOP-VIEW !{ )) p a t t e r n . The attempt t o match the t h i r d element w i l l i n s t i t u t e the computation which c o n t r o l s the r e s t of the system's a c t i o n s . <|PDEF TOP-VIEW (SUPERSET TOP-VIEW SYSTEM-OBJECT) (EXECUTE TOP-VIEW ! (J PARALLEL (META-VIEW (EXECUTE META—VIEW ? META-RESULT) (|TIME= 10)) (WORLD-VIEW (EXECUTE WORLD-VIEW ? WORLD-RESULT) (|TIME= 100)))) > The r e c e i v i n g p a t t e r n ' s t h i r d element i s a c a l l to I PARALLEL t h a t sends EXECUTE messages t o META-VIEW (the name of the garbage c o l l e c t o r ) and WORLD-VIEW (the name of the t o p - l e v e l READ-JEVAL-PRINT loop of the system). The t i m e - s l i c i n g i s 10 to 1 i n favour o f the WORLD-VIEW pa t t e r n e x p r e s s i o n ; t h a t i s the system w i l l spend 90% of i t s time i n a c t i o n , the other 10% i n garbage c o l l e c t i o n . A more s o p h i s t i c a t e d s h a r i n g i s o b v i o u s l y d e s i r a b l e here, but f o r now t h i s w i l l do. <\PDEE META-VIEW (SUPERSET META-VIEW SYSTEM-OBJECT) (EXECUTE META-VIEW $ (RECLAIM) ) > The nature of META-VIEW has to date not been analyzed t o any great d e t a i l - r i g h t now a l l i t does i n answer t o an EXECUTE message i s to c a l l LISP's garbage c o l l e c t o r . What i s r e a l l y needed, of course, i s a means of c l e a n i n g up a l l the u s e l e s s e x e c u t i o n i n s t a n c e s t h a t are hanging around. T h i s has to be done c o n t i n u o u s l y but with care to be sure that p o t e n t i a l l y Chapter V 137 relevant pieces of information are not destroyed i n the process. That i s , the use of old execution environments as records of the events undertaken when they were " a l i v e " necessitates that certain important execution instances be kept. Chapter VI analyzes this whole issue i n more d e t a i l . The other time-shared subgoal of TOP-VIEW i s WORLD-VIEW, pot e n t i a l l y the most c r u c i a l pattern expression i n the entire model. But, as with META-VIEW, i t has for the moment been d r a s t i c a l l y cut back and consists mainly of a READ-|EVAL—PRINT loop which gets entered upon receipt of an appropriate EXECUTE message (usually from TOP-VIEW). The reason i t i s p o t e n t i a l l y so important i s that i t i s the top-level co-ordinator of the model's goals: in any sophisticated model i t would have to formulate plans, decide among many alternate courses of action, figu r e out what to do i f something doesn't work out as planned, and so on. Of course, i t would c a l l i n many other jPEXPRs to help i t out (for example there would l i k e l y be whole planning hierarchies devoted to building and debugging plans of action for various things the model might be interested in doing). <|PDEF WORLD-VIEW (SUPERSET WORLD-VIEW SYSTEM-OBJECT) (EXECUTE WORLD-VIEW ! (| PROG () L1 (PRINT (j EVAL (READ))) (| GO »L1))) > The current WORLD-VIEW jPEXPR merely READs a form, J EVALs i t and PRINTS the res u l t of the form's JEVALuation. That i s , i t i s up to the user to specify the goals of the system. F i r s t , the pattern (LOCATION SELF HOME) i s asserted, indicating that the model (SELF) i s at "home". Then, the message form Chapter V 138 (ATT END-CONCERT (EXECUTE ATTEND-CONCERT SELF CONCERT1 ? ATTEND-RESULT)) i s entered; that i s , the ATTEND-CONCERT pattern expression i s asked to EXECUTE i t s e l f . 5.3.2 A Major Subgoal: ATTEND—CONCERT The goal of the system provided by the user i s for the model (SELF) to attend a concert (CONCERT1) using a plan of action c a l l e d ATTEND—CONCERT (see Appendix II for the complete JPEXPR). The JPEXPR has the form <|PD£F ATTEND-CONCERT (SUPERSET ATTEND-CONCERT ATTEND) (EXECUTE ATTEND-CONCERT SELF ?THIS-CONCERT ! (EVENT-SEQUENCE ) ) > This pattern expression forms the basic plan of action the model expects to undertake in attending the concert., That plan i s contained i n the body of the EXECUTE pattern; that i s , to execute the ATTEND-CONCERT plan reguires matching the EXECUTE pattern. The message pattern (EXECUTE ATTEND-CONCERT SELF C0NCERT1 ? ATT END-RESULT) w i l l match with TBIS-CONCERT being bound to CONCERT1 i n the context of the new execution instance of ATT END-CONCERT (which w i l l be c a l l e d ATTEND—CONCERT—1 for convenience). SELF i s a JPEXPR containing knowledge about the model; C0NCERT1 contains knowledge about the current concert: <|PDEF CONCERT 1 (INSTANCE-OF C0NCERT1 CONCERT) (LOCATION CONCERT 1 QET) (AGENDA CONCERT 1 AGENDA—CONCERT1) > Thus, C0NCERT1 i s a pa r t i c u l a r CONCERT, located at the Queen Chapter V 139 Elizabeth theatre with the agenda AGENDA-CONCERT1. Of course, CONCEET i s also a jPEXPR: <JPDEF CONCEET (SUPERSET CONCERT EVENT) (ENTRANCE-EEQUIREMENT ^CONCERT tTICKET-FOR-CONCERT) > containing the information that the entrance requirements for a pa r t i c u l a r concert i s a pa r t i c u l a r ticket to the concert (note the " f " macros indicatinq instances). S i m i l a r l y , the QET | PEXPR; <|PDEF QET (INSTANCE-OF QET THEATRE) (TICKET-BOOTH QET TICKET-BOOTH-QET) (LOBBY QET LOBBY-QET) (BAR QET BAR-QET) (AUDITORIUM QET &UDITQRIUM-QET) {SEATS QET SEATS-QET) > and AGENDA-CONCERT 1: <JPDEF AGENDA-CONCERT 1 (INSTANCE-OF AG EN DA—CONCERT 1 AGENDA-CONCERT) (ORCHESTRA CONCERT1 VANCOUVER SYMPHONY) (CONDUCTOR ORCHESTRA CONCEET 1 AKIYAMA) (FIRST-HALF CONCEET1 BARTOK-CONCERTO—FOR-ORCHESTRA) (SECOND-HALF CONCERT 1 MOZART-PIANO-CGNCERTO-27) (SOLOIST SECOND—HALF CONCERT1 BRENDL) > The patterns i n these JPEXPRs, of course, contain the names of other JPEXPRs and these JPEXPRs contain patterns with the names of s t i l l other IPEXPRs, and so on i n t y p i c a l semantic network s t y l e connectivity. This network perspective can be better appreciated by representing the " l i n k s " among the previously mentioned JPEXPRs somewhat as i n Figure 5.3. The " t " indicators on the arcs mean that the linkage i s a potential one between instances of the designated source or destination objects, as i s consonant with the macro. Thus, SELF i s going to attend CONCERT1 i f the f i f t h element Chapter V 140 EVENT Figure _5. 3_ Network for Concert Information 141 of the message, ? ATT END-RESULT, matches the f i f t h element of the receiving pattern, !(EVENT-SEQUENCE ) i n the EXECUTE pattern of ATTEND-CONCERT (above). I t , of course, does match, but only i f the lEVALuation of the |EVENT-SEQUENCE |EXPR returns non-NIL. For a f u l l e r explanation of the action of t h i s JEXPR, see Appendix I. Suffice to say here that i t b a s i c a l l y J EVALs each form in i t s body sequentially (much as would a (PROG), with the sid e - e f f e c t of asserting (THEN Xi Xi+1) patterns in a l l execution instances Xi that correspond to major steps in the event sequence (designated by a label in the event sequence body) . The f i r s t such major step encountered i n the EXECUTE of ATTEND-CONCERT i s STEP 1 (GOTO (EXECUTE GOTO SELF !LOC-CONCERT ?GO-PLACE)) In t h i s step the model START—LOCATION (HOME, discovered by looking into the execution environment for the current location of s e l f , i . e . %(LOCATION SELF 7START-L0CATI0N)) to go to the location of the concert (QET, pointed to from CONCERT 1). GOTO i s a JPEXPR which would be concerned with actually achieving the goal of going from HOME to QET, including managing a l l v i s u a l and other cues which might be needed to ensure a r r i v a l at QET. GOTO would also be responsible for changing the current execution environment LOCATION pointer en-route so that i t continued to accurately r e f l e c t changes in location of the model. Even t h i s part requires some work; that i s , there might be representations of location i n the execution environment such Chapter V 142 as (LOCATION SELF VANCOUVER) which needn't be changed, but (LOCATION SELF HOME) certa i n l y needs to be. Generally speaking, a l l LOCATIONS i n the execution environment are changed according to the following r u l e : f i n d the lowest PART-OF intersection between the s t a r t location (e.g. HOME) and the f i n i s h l o c ation (e.g. QET), i n t h i s case VANCOUVER. Then change a l l execution environment LOCATION patterns which designate locations below t h i s i n t e r s e c t i n g node (e.g. change (LOCATION SELF HOME) and (LOCATION SELF POINT—GREY) i f they exist in the execution environment to (LOCATION SELF QET); but don't change (LOCATION SELF VANCOUVER) or (LOCATION SELF CANADA) i f they e x i s t i n the execution environment). This i s guite reasonable since the PART—OF in t e r s e c t i o n defines precisely the l e v e l of d e t a i l being changed by the movement. Similar kinds of automatic execution environment pattern changes must be carried out at many places in the model, such as when a timer i s advanced ( r e c a l l the timing of interrupts from Chapter I I I ) , when the model changes position i n any way, and so on. The processing to undertake such changes would be embedded i n IF-ADDED or IF-REMOVED methods associated with objects such as LOCATION or TIME, and c a l l e d i n when patterns headed by these objects are asserted or deleted by the model's actions, such as GOTO for example. Once finished executing the GOTO, the model has either succeeded or f a i l e d i n i t s attempted t r a v e r s a l of some route (of GOTO's own choosing) between HOME and QET. If i t has f a i l e d , NIL w i l l be returned to ATTEND-CONCERT-1. This eventuality i s Chapter V 143 z allowed for i n the ATTEND-CONCEBT—1 event sequence by c a l l i n g i n the IEXPR CHECK-FAILURE which w i l l check for the f a i l u r e and suggest a course of remedial action i f a f a i l u r e has indeed occurred. CHECK-FAILURE i s currently quite simple, but i t w i l l eventually be vastly upgraded since, as Minsky {1974), Sussman {1973), and others have emphasized, being able to recover from errors i s c r i t i c a l to i n t e l l i g e n t behaviour. Assume that the f i r s t step of the event sequence i s successful; that i s , the model i s at the QET. Prior to buying a t i c k e t to the concert, the model must find out i t s c h a r a c t e r i s t i c s , so i t asks CONCERT 1 {the value of THIS-CONCERT) (ENTRANCE-REQUIR EMENT 1 THIS—CONCERT 7DESIR ED—TICKETS) Since CONCERT 1 doesn't know this information d i r e c t l y , i t must be inherited from the ISA environment. Sure enough, stored with CONCERT i s a pattern (ENTRANCE-REQUIREMENT f/CONCERT f/TICKET-FOR-CONCERT) The attempt to match 7DESIRED-TICKET with tTICKET-FOR-CONCERT res u l t s in the creation of a new instance of TICKET—FOR—CONCERT (see the macro c o n f l i c t table i n Chapter III) c a l l e d say TICKET-F0R-C0NCERT1, which i s bound to DESIRED-TICKET. TICKET-FOR-CONCERT1 w i l l , once the ti c k e t i s bought, contain the c h a r a c t e r i s t i c s of the par t i c u l a r t i c k e t bought for t h i s concert. Right now i t i s a blank slate, containing only an (INSTANCE-OF TICKET—FOR—CONCERT1 TICKET-FOR-CONCERT) pattern. I t can, of course, i n h e r i t from TICKET-FOR-CONCERT information as to tic k e t costs and information as to the QET location represented by the t i c k e t (dubbed REPN here to distinguish i t Chapter V 144 from the LOCATION of the t i c k e t , i . e . i n the ticket booth of the QET) . , <|PDEF TICKET-FOR-CONCERT (SUPERSET TICKET—FOR—CONCERT TICKET) (LOCATION yTICKET-FOB-CONCERT TICKET-BOOTH-QET) {REPN fTICKET—FOB—CONCERT = (X (SUBPART X SEATS-QET))) (COST fTICKET—FOB-CONCEBT !(|COND ({EQ * SEATSQET (IPOINTER REPN TICKET-FOR-CONCERT)) * f DOLLABS-10) {(EQ * SEATSQETLEFTCENTRE (|POINTER REPN TICKET-FOB-CONCERT)) * fDOLLARS-5) ({EQ «SEATSQETRIGHTCENTRE (IPOINTER REPN TICKET-FOB-CONCEBT)) * fDOLLABS-5) (T NIL))) > Also, even higher in the ISA environment there i s the TICKET J PEXPR: <|PDEF TICKET (SUPEBSET TICKET ENTBANCE-BEQUIBEMENT) (SELLER fTICKET fTICKET—S ELLEB) > containing more information about t i c k e t s . A l l t h i s t i c k e t information can be represented in a network such as that shown in Figure 5.4. Having determined i t s t i c k e t needs, the model proceeds to the next major step of ATTEND-CONCERT: the purchasing of the t i c k e t : STEP 2 (BUY (EXECUTE BUY SELF !DESIBED-TICKET ?BUY-RESULT)) Thus, BUY i s asked to execute the purchase of TICKET—FOR—CONCERT 1. Chapter V 145 • ENTRANCE-REQUIREMENT TICKET— SShhm ^TICKET-SELLER TICKET-FORf* CONCERT ot TICKET-FOR-CONCERT1 DOLLARS-10 or DOLLARS-5 t9€AT-*0^™->TICKET- BOOTH- QET anything which i s PART-OF SEATS-QET 1-i ~ T i c k e t Information 146 5*3.3 The BUY Subgoal The BUY IPEXPR i s given i n f u l l i n appendix I I and has g e n e r a l form: <JPDEF BUY (SUPERSET BUY ACTUAL-TRANSACTION) (EXECUTE BUY ?BUYER ?ITEM !(EVENT-SEQUENCE )) > Upon r e c e i p t o f the EXECUTE message from ATTEND—CONCERT, ?BUYER matches SELF (and i s bound t o i t i n BUY-1, the newly c r e a t e d e x e c u t i o n i n s t a n c e of BUY), while ?ITEH, the t h i n g to be purchased, matches TICKET-FOR—CONCERT1 (and i s a l s o bound)., F i n a l l y , the f i f t h element of the r e c e i v i n g p a t t e r n , I (EVENT-SEQUENCE ) matches 7BUY-RESULT once i t has computed to n o n - n u l l . Before l o o k i n g at t h i s computation i n d e t a i l , i t i s f i r s t of a l l i m perative to d i s c u s s SELF, the model's model of i t s e l f . <JPDEF SELF (INSTANCE-OF SELF PERSON) (ROLE-INSTANCE-OF SELF ! (| PROG (OBJECT TRANSACTION) %(PURPOSE SELF (?TRANSACTION SELF ?OBJ ECT)) (JCOND ((EQ TRANSACTION 'BUY) (JCOND { (SUBINSTANCE OBJECT 'TICKET-FOR-CONCERT) (J RETURN 'SELF-AS-A-BUYER OF—CONCERT-TICKET)) ((SUBINSTANCE OBJECT 'ALCOHOLIC-DRINK) {J RETURN 'SELF-AS-A-BU Y ER OF-ALCHOLIC-DRINK) ) (T (J RETURN 'SELF-AS-A-BUYER)))) (T (J RETURN NIL) ) ) ) ) > I f a l l the i n f o r m a t i o n the model knew about i t s e l f were s t o r e d i n one |PEXPR i t would be huge. SELF, t h e r e f o r e , a c t s mainly as a " c e n t r a l switchboard" through which reguests f o r knowledge of SELF are f i l t e r e d on t h e i r way to JPEXPRs r e p r e s e n t i n g views of Chapter V 147 SELF which are more appropriate in the circumstances of the request. One par t i c u l a r view which the model can have of i t s e l f i s in some "r o l e " , f o r example s e l l e r , buyer, lover, worker. I t seems clear that a person's behaviour can a l t e r d r a s t i c a l l y depending on what r o l e he i s playinq. For instance, the interactions to be expected between a supervisor and his student are vastly d i f f e r e n t from those to be expected when the same two people are inte r a c t i n q as friends, d i f f e r e n t s t i l l when they are housemates sharing the household chores. Many c h a r a c t e r i s t i c s , such as sound of voice, s i z e , height, weight, sex, to name a few, are invariant over these r o l e s , but many more, such as att i t u d e , status, kind of vocabulary used, wants and desires, are quite variable. In the SELF pattern expression the difference between a role and the normal viewpoint of SELF i s indicated by the BOLE—INSTANCE-OF pointer as contrasted with the straight INSTANCE-OF pointer. In a l l circumstances the model i s a PERSON, but depending on the s i t u a t i o n , the model can also take on various roles. The ro l e v a r i a b i l i t y i s indicated by the " J " computational element i n the pattern which w i l l return a di f f e r e n t |PEXPB (depending on context) for each role of the model. BOLE-INSTANCE-OF pointers are accessed when patterns l i k e (STATUS ), (ATTITUDE ), (WANT ), f a i l to match i n a 1PEXPB l i k e SELF. Since such patterns represent q u a l i t i e s which are role dependent, a search for a match would be directed up Chapter V 148 fiOLE-INSTANCE-OF l i n k s before anything else i s done. Bole-instances (as jPEXPBs from which BOLE-INSTANCE-OE pointers are followed can often be designated) are i n t e r e s t i n g i n that they give a way to view an object i n many diff e r e n t l i g h t s . There i s r e a l l y no r e s t r i c t i o n on what can be a r o l e instance, so that, for example, an instance can be a role instance of another r o l e instance, or of an instance, or of a c l a s s , or of an animate object, or of an inanimate object, etc. Getting back to the model's attempt to execute BUY, the attempt to match the 7BUY-RESULT message element r e s u l t s i n the |EVALuation of the {EVENT-SEQUENCE ) element of the receiving pattern. Before undertaking any steps, the model checks that BUYER i s SELF and, finds the physical LOCATION of the t i c k e t (inherited from TICKET-FOR-CONCERT, the answer i s TICKET-BOOTH-QET). The model then undertakes STEP1: STEP 1 (GOTO (EXECUTE GOTO SELF !PLACE-ITEM ?GOT-THERE)) that i s , i t goes to the location of the t i c k e t (TICKET-BOOTH-QET). I f t h i s i s successful, then the model expects to f i n d the s e l l e r of the item at t h i s place: i t thus asks TICKET-FOR-CONCERT1 for the s e l l e r of the item, th i s time in h e r i t e d from TICKET. Of i n t e r e s t here i s that matching (SELLER TICKET—FOR-CO NCERT 1 ? S ELL ER) against (SELLER tTICKET tTICKET-SELLER) succeeds with a new instance of TICKET-SELLER being created when 7SELLER i s compared to fTICKET-SELLER (see macro-conflict table. Chapter I I I ) . Chapter V 149 <|PDEF TICKET-SELLER 1 (INSTANCE—OF TICKET-SELLER1 TICKET-SELLER) > <J PDEF TICKET-SELLER (SUPERSET TICKET—SELLER SELLER) (SELL fTICKET—SELLER ^TICKET) (WANT f/TICKET-SELLER (EXCHANGE TICKET-SELLER—HAS—BARGAINING-POSN TICKET-SELLER-WANTS—BARGAINING-POSN)) > This new instance, c a l l e d TICKET-SELLER 1, represents the expected new s e l l e r of ticke t s the model expects to find i n the t i c k e t booth and w i l l have information added to i t when d e t a i l s of the pa r t i c u l a r t i c k e t s e l l e r are discovered during the ensuing transaction to buy the t i c k e t . Next, certain important, patterns are asserted in the BOY-1 execution instance so that the information can be used by subgoals of BOY-1 to determine the i d e n t i t i e s of the s e l l e r and buyer, the purpose of the s e l l e r , the purpose of the buyer, and on the focus of attention of the buyer., F i n a l l y , the c r u c i a l part of executing BOY i s encountered: STEP2, where the model engages i n a conversation with the t i c k e t s e l l e r so as to obtain the t i c k e t . To this end, a s c r i p t , BUY-CGNVERSATION, i s asked to EXECUTE i t s e l f : STEP2 (BOY-CONVERSATION {EXECUTE BUY-CONVERSATION !BUYER !SELLER 1ITEJ3 7CONV-RES0LT) ) Chapter V 150 5.4 Scripts although t h i s i s a new section, and i t concerns language, always keep i n mind that there i s no conceptual difference between s c r i p t s and the high-level JPEXPRs that have been traversed to get t h i s f a r . Thus, conversation i s an a c t i v i t y l i k e the others, requiring i t s own expectations, subgoals, f a i l u r e processing, etc. The particular pattern expressions to be discussed here are c a l l e d s c r i p t s (a name gleaned from the Abelson - Schank work undertaken in the l a s t few years (e.g. Abelson (1973))). Scripts contain expectations as to both sides of a conversation. They thus direct both the int e r p r e t a t i o n and production of utterances, look after the seguencing of the utterances, explain the loose strands that l i e around after interpretation or production of an utterance, t i e together the various utterances into some coherent whole, extract any relevant information from the utterances (and act upon t h i s data i f necessary), etc. 5,4.1 BUY-CONVERSATION The s c r i p t of most concern here i s BUY-CONVERSATION (the complete version of which i s given i n Appendix II) I ts form i s <|PDEF BUY-CONVERSATION {SUPERSET BUY-CONVERSATION SOCIAL-TRANSACTION-CONVERSATION) (EXECUTE BUY-CONVERSATION 7BUYEB ?SELLER ?ITEM '(EVENT-SEQUENCE )) > BUY-CONVERSATION i s c a l l e d in EXECUTE mode by BUY. The message pattern i s (after jEVALuation of macros i n the context of BUY-1) Chapter V 151 {EXECUTE BUY—COHVERSATION SELF TICKET-SELLEE1 TICKET—FOR—CONCERT 1 ?CONV-RESULT) and i t c l e a r l y matches the BUY-CONVERSATION pattern (EXECUTE BUY-CONVERSATION ? BUYER ?SELLER ?ITEM 1(EVENT-SEQUENCE )) with appropriate bindings of BUYER, SELLER, and ITEM i n the context of the newly created execution instance BUY-C0NVERSATI0N-1. This matching i s , of course, subject to the constraint that !(EVENT-SEQUENCE ) JEVALs t o non-null. The event sequence, as i s usual for EXECUTE patterns, contains the plan of action to be executed. It consists of the subgoals lab e l l e d STEP 1 # STEP2, ... , STEP5, denoting c a l l s to f i v e sub-scripts: WHAT—DO-YOU—WANT, BARGAIN, BARGAIN (again), EXCHANGE, and FAREWELL. The goal tree would thus look something l i k e Figure 5.5., STEP 1 of BUY-CONVERSATION suggests that a sub-script c a l l e d WHAT-DO-YOU-WANT i s to be expected as the f i r s t conversational foray. This s c r i p t w i l l be discussed shortly; i t merely represents a part i c u l a r kind of "Hello" - "How are you?" utterance exchange which seems necessary i n order to establ i s h (or i n t h i s case confirm) conversational roles (see, for example, Schegloff (1971) for a discussion of t h i s phenomenon) at the beginning of a conversation. If t h i s step successfully concludes then the sub-script (or utterance) must be " t i e d - i n " to some sort of representation of the conversation to date. Such t i e i n g - i n promises to be f a i r l y c r u c i a l and w i l l reguire everything from recognizing eguivalent concepts in d i f f e r e n t utterances a l l the way to sophisticated Chapter V 152 TOP-VIEW-1 ex META-VIEW-1 ex WORLD-VIEW-1 ex.. ATTEND-CONCERT-1 WHAT-DO-YOU WANT-1 BUY-1 BUY-CONVERSATION-1 K BARGAIN-1 BARGAIN-2 EXCHANGE-1 FAREWELL-1 Figure .5.5, -Tree for the Ticket Buying Conversation 153 conversational implicatures and r e a l world inferences to link up diverse kinds of discourse. Right now, since the conversation proceeds more or less as expected, t i e i n g - i n i s somewhat down played (consisting only of recording the seguence of the sub-scripts) since the EVENT-SEQUENCE macro code, containing the expected conversational structure, i s available for inspection, and i t w i l l correspond f a i r l y c losely to the t a i l o r e d r e a l i t y . The second and t h i r d steps of BUY-CONVEBSATION are involved with haggling over the c h a r a c t e r i s t i c s of the item to be purchased: STEP2 with the c h a r a c t e r i s t i c s the buyer wants; STEP3 with those the s e l l e r wants. Thus, i n the t i c k e t buying s i t u a t i o n , the bargaining f i r s t involves the l o c a t i o n represented by the t i c k e t , then the cost of the t i c k e t . Although th i s too i s a vastly s i m p l i f i e d version of what happens i n a buying s i t u a t i o n , I believe i t i s substantially correct: that i s , the customer states his wishes, these are met, then the price he must pay to meet these wishes i s determined. People, however, seem to have many much more speci a l i z e d s c r i p t s that operate i n p a r t i c u l a r contexts (e.g. department store s c r i p t s , o r i e n t a l bazaar s c r i p t s , probably even t i c k e t buying s c r i p t s , but i n an attempt to be a b i t more general, I'm using a more general, but also a more s k e l e t a l s c r i p t here). Moreover, even within a s c r i p t , there seems to be a large degree of f l e x i b i l i t y that enables skipping the actual verbalizations.of large chunks of the s c r i p t , allowing them to be inferred instead., I f the bargaining has been successfully carried out, the agreed upon location and cost are added to the model's knowledge of the Chapter V 154 t i c k e t ( i . e . TICKET-F0R-C0NCERT1). Thus, an EXCHANGE of the appropriate amount of money for the desired ticket can take place (STEP4). This i s in t e r e s t i n g i n that i t i s not b a s i c a l l y a verbal action, but i s instead a motor action. The i n d i s t i n g u i s h a b i l i t y of verbal from other actions allows t h i s kind of intermixture to be e a s i l y and conveniently accomplished. Theoretically at l e a s t , gestures and any other method of communication are perfectly f e a s i b l e . The f i n a l portion of BUY—CONVERSATION i s a c a l l to FAREWELL, a sub-script which w i l l make utterances that terminate the conversation much as WHAT-DO-YOU-WANT started i t . This concludes the BUY-CONVERSATION s c r i p t , which returns the current execution instance, complete with the t i e d - i n utterance patterns and any other information accumulated during the execution of the s c r i p t . Thus, the o r i g i n a l message pattern match and the BUY-CONVERSATION-1 execution instance i s bound to CONV-RESULT i n BUY-1, and BUY-1 i s resumed. I t can then make use of any information that i t needs from th i s execution instance. A f i n a l note about executing BUY-CONVERSATION: the execution here has been with the model as buyer and the t i c k e t s e l l e r as s e l l e r , but there i s no reason i t couldn't have been the other way around, or even with both buyer and s e l l e r being the model or neither being the model. This f l e x i b i l i t y i s extremely useful since t h i s one s c r i p t can handle many di f f e r e n t s i t u a t i o n s . I t also suggests that the model assigns to others i t s own motivations; that i s the s e l l e r ' s role as defined i n the s c r i p t i s what the model i t s e l f would be happy to take. I t thus Chapter V 155 a t t r i b u t e s to any other s e l l e r the same expectations i t would have of i t s e l f i n a si m i l a r s i t u a t i o n . The subgoals c a l l e d during execution of BUY-CONVERSATION are themselves s c r i p t s . I would now l i k e to outline them. The f i r s t one to be executed i s WHAT-DO-YOU-WANT, a subset of the more general GREETING pattern expression. 5.4.2 WHAT-DO-YOU-WANT The WHAT—DO—YOU-WANT s c r i p t (see Appendix II) i s somewhat di f f e r e n t from BUY-CONVERSATION i n that i t actually c a l l s i n speech act pattern expressions to d i r e c t the int e r p r e t a t i o n or production of utterances i n contrast to the sub-scripts seen above. As usual, i t receives an EXECUTE message, i n t h i s case (EXECUTE WHAT-DO-YOU-WANT TICKET—SELLER 1 SELF ?WHAT-WANT-CONV) which matches the receiving pattern (EXECUTE WHAT-DO-YOU-WANT ?SPEAKER1 7SPEAKER 2 ! (EVENT-SEQUENCE )) Also as usual, everything matches except the l a s t elements where the standard EVENT-SEQUENCE computation must take place f i r s t . This computation proceeds by establishing the conversational i d e n t i t i e s of the speakers, that i s determining whether to int e r p r e t (expect) an utterance from speaker-i or whether to produce (execute) an utterance for speaker-i. E s s e n t i a l l y , i f speaker-i i s SELF, then the s c r i p t must generate an utterance whenever i t i s speaker-i's turn to talk; otherwise, speaker-i i s somebody else and the s c r i p t should attempt to comprehend an utterance from speaker-i. It i s possible for the s c r i p t to be Chapter V 156 used i n s i t u a t i o n s where the model takes none, one, or both of the speaker r o l e s . The s c r i p t c o n t a i n s 2 s t e p s : STEP1: send an EXPECT (or EXECUTE) message t o the speech-act INQUIRE i n d i c a t i n g t h a t speaker-1 i s t o make an i n g u i r y of speaker-2 as to the purpose of speaker-2; STEP2: send an EXECUTE (or EXPECT) message t o RESPOND i n d i c a t i n g t h a t speaker-2 should be responding to speaker-1's i n g u i r y with h i s purpose. Thus, f o r the t i c k e t buying episode, the model should EXPECT speaker-2 (the t i c k e t s e l l e r ) t o i n g u i r e as to the purpose of speaker-1 (the model) and should then EXECUTE a response i n d i c a t i n g i t s purpose (obtained by l o o k i n g i n t o the ex e c u t i o n environment f o r some pa t t e r n of the form (PURPOSE SELF ?WHAT) ; i n t h i s case the matching p a t t e r n (PURPOSE SELF (BUY SELF TICKET-F0R-CONCERT1) ) would be found). An i n t e r e s t i n g problem here i s j u s t how f a r up the execution environment t o go when l o o k i n g f o r a match, s i n c e an even higher order purpose i s t o attend the co n c e r t , and there c o u l d be even higher ones yet. The assumption has been to go to the nearest such purpose, i t being the one (presumably) that i s being s o l v e d by the c u r r e n t subgoal. Upon completion of the EVENT-SEQUENCE, the p a t t e r n matches and WHAT-WANT-CONV i s bound to the new WHAT-DO-YOU-WANT-1 exe c u t i o n i n s t a n c e c r e a t e d t o handle the message. C o n t r o l then resumes i n BUY-CONVERSATION-1 which goes t o i t s next s t e p : t o Chapter V 157 BARGAIN between what the buyer wants and the s e l l e r has. 5.4.3 BARGAIN Before actually c a l l i n g in the BARGAIN s c r i p t , BUY-CONVERSATION must f i r s t set up bargaining positions f o r the s e l l e r and buyer. The es s e n t i a l idea i s that i n bargaining f o r anything (including a ticket) each bargainer has two i n i t i a l p ositions: he owns something and wants something else i n exchange for i t . A successful bargaining session w i l l match what party A wants with what part B owns and also w i l l match what party A owns with what party B wants. In the t i c k e t buying s i t u a t i o n the model i t s e l f wants a ticket representing a certain desired location and suspects that the t i c k e t s e l l e r owns such a t i c k e t ; the model owns a certain small amount of money which i t i s w i l l i n g to exchange in return for the t i c k e t and suspects that the s e l l e r wants money appropriate to the cost of the t i c k e t . The model's bargaining positions are role dependent and are thus accessed up ROLE-INSTANCE-OF pointers from SELF as outlined e a r l i e r . In t h i s case SELF-AS-A—BUYER-OF-CONCERT—TICKET <|PDEF SELF-AS-A-BUYER—OF-CQNCERT-TICK ET (SUPERSET SELF-AS-A-BUYEB-QF-CONCERT-TICKET SELF-AS-A—BUYER) (BUY SELF fTICKET—FOB-CONCERT) (WANT SELF (EXCHANGE SELF-HAS-TICKET-BARGAINING-POSN SELF-WANTS-TICKET-BARGAINING-POSN)) > would be found i n which resides the pattern (WANT SELF (EXCHANGE SELF-HAS-TICKET-BAHGAINING-POSN SELF-WANTS-TICKET-BARGAINING-POSN)) Chapter V 158 containing the model's bargaining positions. The t i c k e t s e l l e r ' s bargaining positions, or at least the model's perceptions of the t i c k e t s e l l e r ' s bargaining positions, can be accessed from TICKET—SELLER1 by in h e r i t i n g the {WANT fTICKET-SELLER {EXCHANGE TICKET-SELLER—HAS—BARGAINING-POSN TICKET-SELLER-WANTS-BARGAINING-POSN)) pattern from TICKET-SELLER (there being no ROLE-INSTANCE-OP pointer i n TICKET-SELLER 1). Thus, the BARGAIN |PEXPR (see Appendix II) i s sent the message (EXECUTE BARGAIN TICKET-SELLER 1 SELF TICKET-SELLER-HAS-BARGAINING-POSN SEL F-WANTS-BARG AINTNG-POSN TICKET—FOR—CONCERT 1 ?BARGAIN1-CONV) which w i l l match the BARGAIN pattern (EXECUTE BARGAIN 7QUESTIQNER ?RESPONDER 7P0SN-Q 7POSN-R ?ITEM ! (EVENT-SEQUENCE )) i f the EVENT-SEQUENCE computation succeeds. This computation t r i e s to achieve a successful compromise between two probably i n i t i a l l y d i s t i n c t bargaining positions. In this example one of the positions i s TICKET—SELLER-HAS-BARGAINING-POSN <|PDEF TICKET—SELLER-HAS-BASGAINING-POSN (SUPERSET TICKET—SELLER-HAS—BARGAINING—POSN H AS-BARGAINING-POSN) S1 : (REPN fTICKET .'(JPOINTER REPN TICKET)) (IMPORTANCE fTICKET-SELLER /S1 6) (BARGAIN-ORDER TICKET-SE1LER-HAS-BARGAINING-POSN (REPN)) > representing knowledge which the model believes the t i c k e t s e l l e r to hold in regard to his wants. Looking at the JPEXPR, the following can be gleaned: Chapter V 159 fi) by S1, the model believes the t i c k e t s e l l e r to have an i n d i v i d u a l t i c k e t (fTICKET) which represents any location suitable to that t i c k e t ( ! ( | PO INTEB BEPN TICKET)); (i i ) the model believes the importance of fact (i) to the t i c k e t s e l l e r i s 6; ( i i i ) the model believes that bargaining can take place i n regard to the location the t i c k e t represents. The BARGAIN-OBDEB pattern not only designates which patterns of the bargaining position are suitable for negotiation, but also indicates the order of resolution of various pieces of information (for example i n the drink buying episode, the bargaining at t h i s stage involves s e t t l i n g both the brand of the drink and the kind of mixer, i n that order, rather than just the single issue of t i c k e t BEPN here). The other bargaining position contains the model's own desires for the c h a r a c t e r i s t i c s of the ide a l concert t i c k e t : <]PDEF SELF-WANTS-BAB GAINING-POSN (SUPERSET SELF—WANTS—BARGAINING-POSN WANTS-BARGAINING—POSN) 51 : (BEPN VTICKET-FOR-CONCERT fSEATSQETCENTRE) 52 : (REPN fTICKET-FOR-CONCERT fSEATSQETLEFTCENTRE) 53 : (REPN fTICKET-FOR-CONCERT fSEATSQETRIGHTCENTRE) (IMPORTANCE SELF /S1 10) (IMPORTANCE SELF /S2 8) (IMPORTANCE SELF /S3 8) (BARGAIN-ORDER SELF-WANTS-BARGAINING—POSN (REPN) ) > Similar to the t i c k e t s e l l e r ' s bargaining stance, the model i t s e l f has three positions in regard to the location represented Chapter V 160 by the t i c k e t . I t f i r s t of a l l wants (IMPORTANCE 10) a seat i n the centre portion of the QET; then, f a i l i n g that, i t would l i k e a seat i n QET l e f t - c e n t r e or QET right-centre (with equal IMPORTANCE of 8 ) . Grist for the barqaininq m i l l i s REPN, as for the s e l l e r . So, successfully executinq the BARGAIN s c r i p t w i l l involve brinqinq into correspondence these two i n i t i a l barqaininq positions. Although the code i s confusinq, the basic idea i s quite simple: STEP 1: the questioner (the ticket s e l l e r ) asks the responder (the model) about his feelings on the next issue of importance (determined by the BARGAIN-ORDER in the position of the questioner, in t h i s case REPN) and goes to STEP2. I f there are no more issues to be resolved, the s c r i p t terminates successfully, returning the current BARGAIN-1 execution instance. STEP2: the responder states his i n i t i a l stance on the current issue ( i . e . the most important pattern appropriate to the issue i n his bargaining position). STEP3: the questioner extracts the stated stance of the responder from his actual utterance and matches i t to the questioner's own current stance (extracted from his barqaininq position). I f they match, the agreed upon stance i s asserted in item and onto STEP5; else Chapter V 161 the questioner reduces his demands by taking the next most important stance in his bargaining position, inquiring as to the s u i t a b i l i t y of that, and going to STEP4. I f the demands cannot be further reduced (i. e . he has run out of patterns), then go to STEP7. STEP4: the responder goes through a s i m i l a r process of extracting a stated stance from the guestioner's l a s t utterance, matching i t to his own stance, and, i f successful, asserting the agreed upon stance in item before going to STEP6; else, reducing his demands then stating them then going to STEP3; and f i n a l l y , i f there i s no way of reducing the demands, going to STEP 8. STEPS: the questioner, having matched his position on the current issue with that of the responder, agrees with him on the current mutually held stance and qoes to STEP1 so that the next issue (as determined by BARGAIN-ORDER) can be resolved. STEP6: the responder, havinq matched his position with that of the questioner agrees with him on the mutually held position, and qoes to STEP1 so that the next issue can be resolved. STEP7: the questioner, havinq found i r r e c o n c i l a b l e Chapter V 162 disagreement on the issue the responder says so terminates i n f a i l u r e . with the responder, says so, as well, and the s c r i p t STEP8: the responder, having found i r r e c o n c i l a b l e disagreement on the issue with the guestioner, says so, the questioner says so as well, and the s c r i p t terminates i n f a i l u r e . When BARGAIN i s called the f i r s t time by BUY-CONVERSATION the following assignments are made: the guestioner i s TICKET—SELLER 1, the responder i s SELF, the guestioner's bargaining position i s TICKET-SELLER—HAS-BARGAINING-POSN, the responder's bargaining position i s SELF-w ANTS—BARGA.INING-POSN, and the item i s TICKET—F0R-C0NCERT1. The i n i t i a l issue, gleaned from the bargaining JPEXPRs, i s REPN, that i s the contestants w i l l discuss where the seat for the concert w i l l be. The bargaining i s very co-operative i n t h i s case (this i s determined by the closeness of the stances in the bargaining p o s i t i o n s ) , and the model and t i c k e t ; s e l l e r eventually agree on a t i c k e t representing a location i n the centre of the QET. Obviously, t h i s i s a rather s t y l i z e d version of bargaining, but i t does i l l u s t r a t e some intere s t i n g facets of JLISP and the analysis of language. For the f i r s t time generators are used to cycle through stances as the guestioner or responder f a l l back on lesser positions during the course of the bargaining. , Thus, Chapter V 163 the EXPR MOST-IMPORTANT w i l l return the most important pattern i n a jPEXPR matching a par t i c u l a r other pattern, but i s defined as a generator so can be restarted to generate the next most important pattern and so on. The second i n t e r e s t i n g thing i s how the model i s able to use i t s expectations to extract the actual stance of i t s conversant from his utterances., The EXPR COVER-PATTERN w i l l look through the execution instance generated i n the interp r e t a t i o n or production of an utterance for a pattern (CONTENT ex-instance ?ANYTHING) which w i l l contain the basic content of what was said devoid of any "extraneous" things such as the speaker, the l i s t e n e r , the motivation for the utterance. Then, COVER-PATTERN w i l l match i t s expected stance against patterns i n the t h i r d element of the CONTENT pattern, hoping to fi n d one which the stance covers i n the sense that a l l elements of the stance are egual to or i n the ISA environment of a l l elements of the CONTENT pattern. If such a covering match i s found, the CONTENT pattern w i l l replace the stance in the model's further deliberations. I could (and perhaps should) have gone further here to allow for the discovery of any pattern that can be taken for a stance, not just a pattern that i s covered. But, to allow that much v i o l a t i o n of expectations would probably destroy the nice convergence that BARGAIN currently exhibits and hence set up p o t e n t i a l l y i n f i n i t e loops of offer and counter-offer. The whole problem of handling unexpected information and integrating i t into a s c r i p t i s one that has been sloughed off on the Chapter V 164 CHECK-FAILURE and TIE-IN EXPRs and i s a problem that c l e a r l y needs much more work. For the time being, BARGAIN and other s c r i p t s naively assume that a l l w i l l go as expected or that CHECK-FAILURE or TIE-IN w i l l be able to explain anomalies so that processing can continue according to s c r i p t . One other problem has been lurking i n the shadows as well: the problem of sequencing utterances i n model - conversant - model alter n a t i o n . This actually i s not a problem, since i f there are two successive steps in a s c r i p t that happen to involve the same speaker, then the speaker merely has a longer utterance with no break i n between at the surface l e v e l . This holds true even i f the two successive steps happen to be i n two d i f f e r e n t s c r i p t s perhaps even at di f f e r e n t l e v e l s . Thus, when BARGAIN-1 i s returned to BUY-C0NVERSATI0N-1, the next step of BUY-CONVERSATION-1 i n i t i a t e s a new round of BARGAINing, t h i s time with the questioner and responder roles reversed. It i s quite l i k e l y , therefore, that the same speaker (the model or the t i c k e t s e l l e r ) w i l l speak back-to-back utterances as the l a s t step of BARGAIN-1 and as the f i r s t step of the new BARGAIN (called, say, BARGAIN-2). BARGAIN-2, of course, works i n a s i m i l a r manner to BARGAIN—1 with SELF-HAS-BARGAINING—POS N and TICKET—SELLER-WANTS-BARGAINING-POSN (see Appendix II) being the two new bargaining positions, and COST obviously being the issue at hand. C l e a r l y , early agreement w i l l be reached here as well. The bargaining i s thus complete. Chapter V 165 5*4.4 EXCHANGE When BARGAIN-2 i s finishe d , the motor-action EXCHANGE i s executed (see Appendix I I ) . Of primary si g n i f i c a n c e here i s the s i m i l a r i t y between motor-actions and speech actions, and the ease with which the two can be mixed. The message (EXECUTE EXCHANGE SELF TICKET-SELLER1 DOLLARS-10 TICK ET-FOR-CONCERT1 ?EXCH-RESULT) matches the pattern (EXECUTE EXCHANGE 7PERSON1 7PERSON2 ?ITEH1 ?ITES2 !(EVENT-SEQUENCE )) with the appropriate bindings being made and the execution of the EVENT-SEQUENCE ensuing. This seguence has four steps: STEP 1: where PERSON 1 gives to PERSON2 the f i r s t item, in t h i s case the model gives to the ti c k e t s e l l e r 10 dol l a r s . STEP2: PERSON2, the ticket s e l l e r , says thanks. STEP3: PERSON2, the tic k e t s e l l e r , gives to PERSON 1, the model, the second item, the ti c k e t f or the concert. STEP4: PERSON 1, the model, says thanks. Thus, steps 1 and 3 are motor-factions; steps 2 and 4 are speech acts. Note that i f the model i s the i n s t i g a t o r of a pa r t i c u l a r action (speech or otherwise) the message w i l l be EXECUTE; Chapter V 166 otherwise i t w i l l be EXPECT. In the l i n g u i s t i c case an EXECUTE means to generate an utterance; an EXPECT means to interpret an utterance. In the non - l i n g u i s t i c case an EXECUTE means to perform the action (e.g. giving); an EXPECT means to expect somebody else to perform the action, so that i f the model i s expecting a give, say, then i t should expect to see certa i n actions such as hand movements, and should prepare i t s e l f to take the proferred item i f the model i s the intended r e c i p i e n t . 5*4.5 FAREWELL Upon executing the EXCHANGE, the f i n a l step i n the BUY-CONVERSATION s c r i p t i s entered into: the execution of the FAREWELL s c r i p t which merely consists of an exchange of goodbyes between the two participants. JLISP code for t h i s JPEXPR also resides i n Appendix I I . This successfully ends the BUY-CONVERSATION s c r i p t . BUY-CONVERSATION now returns to BUY which i s also done so i t returns to ATT END—CONCERT to proceed to the next step in the concert plan. Before going on, i t would be useful to look at the following "pseudo-conversation" which might have been generated by the BUY-CONVERSATION s c r i p t . , The actual verbalizations are too sophisticated, by and large, to be e a s i l y handled at t h i s time, but the basic speech acts, seguencing, and general flavour of the conversation i s exactly as i t would be produced by the s c r i p t . This conversation would be the r e s u l t of executing a Chapter V 167 t y p i c a l BUY-CONVERSATION s c r i p t with, s e l l e r = TICKET-SELLER 1, buyer = SELF, and ITEM = TICKET-FOR-CONCERT1. {HHAT-DO-YOU-WANT-1} S e l l e r : "Yes?" Buyer: "I would l i k e to buy a ti c k e t to the concert. 1 1 {BARGAIN- 1} S e l l e r : "Where would you l i k e to s i t , s i r ? " Buyer: "Somewhere i n the centre of the theatre i f possible." S e l l e r : "O.K. I've got that." {BARGAIN—2} Buyer: "How much would i t cost?" S e l l e r : "10 d o l l a r s . " Buyer: " A l r i g h t . " £ EXCHANGE-1} {gives money to the s e l l e r ) S e l l e r : "Thanks." (gives t i c k e t to the buyer) Buyer: "Thank you." {FAREWELL-1} "So long." S e l l e r : "Goodbye." Of particular i n t e r e s t here are the overlaps between BARGAIN-2 and EXCHANGE-1 and also between EXCHANGE-1 and FAREWELL-1. As well, note the weakness of the bargaining over the location of the seat: t h i s i s the r e s u l t of specifying the Chapter V 168 seat location {i.e. SEATSQETCENTRE) too generally i n the model's bargaining position, and also in using a BARGAIN which i t s e l f i s too general. Likely i n a r e a l l y top-notch simulation of t i c k e t buying, there would be a l o c a l bargaining pattern expression that knew about a l l the p a r t i c u l a r s of seat s e l e c t i o n , e s p e c i a l l y the f a c t that a s p e c i f i c seat would be preferred at t h i s point. The decision to encode BARGAIN as i t has been here was made so that i t could also be used f o r the drink buying episode, and hence so that the potential generality of the model could be more conclusively demonstrated. Before looking at the drink buying conversation and the discussion with a friend at intermission, i t seems long overdue to f i r s t of a l l elaborate the kinds of things which go on at the speech act and language l e v e l s of the model, where actual words are manipulated. 5.5 Speech Acts Speech acts are a l e v e l of l i n g u i s t i c description that form an interface between the i n t e r n a l meanings of concepts and the external l i n g u i s t i c r e a l i z a t i o n s of these concepts. Being concerned with single speech units uttered by a s p e c i f i c speaker, they are f a r less general than s c r i p t s ; however, they are not usually concerned with the d e t a i l s of language in t e r p r e t a t i o n or generation and hence are more general than the "language l e v e l " yet to be described. As was seen during the discussion of s c r i p t s , speech acts Chapter V 169 are those pattern expressions that are sent a message to EXPECT or EXECUTE a single utterance. Thus, INQUIRE, RESPOND, AGREE, DISAGREE, THANKS, GOODBYE, are speech acts; there couia, of course, be many more such as INFORM, REQUEST, in l i n e with the Austin (1962) / Searle (1969) designations. Obviously, the l e v e l of l i n g u i s t i c description promoted here as the speech act l e v e l has much in common with the speech act concept of Austin and Searle, although neither Austin nor Searle pursue a computational approach to the subject, nor do I talk i n terms of "locutionary", " i l l o c u t i o n a r y " , or "perlocutionary" forces. Furthermore, I do not believe i n speech acts as the c r u c i a l l i n g u i s t i c factor, but rather I look on them as subgoals of more general plans. They are l i k e any other subgoals except that they are concerned with accomplishing l i n g u i s t i c actions not other actions. P. Cohen's (1977) work on conversation, where, among many other things, speech acts are planned much as any other actions are planned, lends credence to the importance of t h i s unifying view. 5-5 .1 IIPJJIRE To see how speech acts work, i t would be useful to take a p a r t i c u l a r example, say INQUIRE, and see what i t does. The code for INQUIRE i s i n Appendix I I . There are two main types of message that can be received by a speech act: EXPECT, when the speech act w i l l be uttered by someone else and thus needs to be interpreted; and EXECUTE, the old standby implying the speech act needs to be produced. Chapter V 170 Assume, f i r s t , that INQUIRE i s a subgoal of the WHAT-DO—YOU-WANT—1 s c r i p t activation and has been sent the message {EXPECT INQUIRE TICKET-SELLER1 SELF (PURPOSE SELF *UNKN0WN*) 7NEW-UTT) Then, the receiving pattern (EXPECT INQUIRE 7SPEAKER 7LISTENEB 7C0NTENT !{JPROG )) w i l l match with SPEAKER bound to TICKET-SELLER1, LISTENER to SELF, CONTENT {i.e. what the inguiry should be about) to {PURPOSE SELF *UNKNOWN*) , and the (JPROG ) w i l l do the actual expectation processing before being bound to NEW-UTT. (A i PROG i s used because speech acts seem a low enough l e v e l of analysis not to reguire the memory preservation features provided by EVENT-SEQUENCE). The f i r s t thing done i f an INQUIRE speech act i s expected i s to check the execution environment to see i f a surface l e v e l utterance already has been "heard". I f not, then the "read buffers", the model's single "sense", must be emptied {using the EXPR HEAR-WORDS) of t h e i r words and read into a l i s t c a l l e d UTTERANCE. In a more sophisticated system, HEAR-WORDS would construct a pattern expression (rather than keep a l i s t ) to contain the words of the input. This JPEXPR would keep a complete record of seguencing and timing information, morphology decisions, as well as the words themselves. Whenever any other JPEXPR needed to access the words, th i s JPEXPR would be gueried. However, i n t h i s s i m p l i f i e d model, HEAR-WORDS i t s e l f i s responsible for reading the words, separating them from one Chapter V 171 another, doing a l l morphology on them, the p o s s i b i l i t y of ambiguities at t h i s l e v e l being ignored. Produced i s a unigue l i s t of words that have to be interpreted by the speech act and i t s language subgoals. So, having read i n the utterance (and asserted i t for the reference of subgoals) the speech act checks to see i f any subset or subinstance of i t s e l f would be more appropriate for the interpretation of that utterance. Thus, i t c a l l s in the EXPR CHECK-FOR-ACTIVE-SUBSET which w i l l look to see i f there i s any pattern expression that i s a subset or subinstance of INQUIRE and that has been activated associatively (or in some other non-goal directed way) and wants to run. Although the description of non-goal directed processing w i l l be discussed i n Chapter VI, a b r i e f introduction to associative ac t i v a t i o n i s i n order here. 5.5.2 The Associative Activation of YES2 B r i e f l y , a pattern expression does not always have to be c a l l e d i n to accomplish a subgoal of another pattern expression, but can instead receive ASSOC messages from closely related concepts that themselves been activated top-down as subgoals of other pattern expression, a s s o c i a t i v e l y by the reception of ASSOC messages (see YES2 i n Appendix II for an ASSOC pattern which might receive such a message), or, i f the model were t r u l y general, sensorily by the presence of external s t i m u l i . For example having spawned the BUY \PEXPR, a natural association might be the BUY-CONVERSATION s c r i p t even before i t i s actually Chapter V 172 c a l l e d in top-down; recognizing a DOG might trigger associations to BARK, TAIL, and other "doggy" things. If enough of these associative t r i g g e r s contact a pattern expression, i t would l i k e l y consider i t s e l f strongly relevant to the current s i t u a t i o n and would consequently l i k e to he integrated into the top-down scheme of things. To t h i s end, i t "turns i t s e l f on" ("lights up") so that hopefully top-down j PEXPRs w i l l notice i t and try to incorporate i t . Such recognition i s done by EXPRs l i k e CHECK-FOR-ACTIVE-SUBSET c a l l e d i n at the discretion of the top-down 1PEXPRs (just when to make such checks i s a d i f f i c u l t problem). In t h i s case INQUIRE asks i f there are any active subsets of i t s e l f which, for whatever reason, want to be integrated i n t o the model's goals. Assume that the word "YES" (word |PEXPRs are surrounded by "" marks to distinguish them from concept JPEXPRs) has been read and has spread an associative activation trace to the speech acts YES1 (affirmative agreement) and YES2 (what can I do for you?), among others. YES 1 and YES2 would both consider the presence of the word "YES" as being conclusive evidence they are relevant to the current s i t u a t i o n , so they would " l i g h t up". INQUIRE, looking for only those JPEXPRs which are subsets or subinstances of i t s e l f , would see YES2 (but not YES1) and hence decide that there i s indeed an active subset of i t s e l f which would be appropriate here. I t therefore decides to replace i t s e l f by the more s p e c i f i c YES2. Notice that YES 1, although associatively active, w i l l not get incorporated into the top-down context and hence w i l l eventually atrophy and Chapter V 173 disappear (more work for the garbage collector!) How does such replacement work? There i s an EXPR c a l l e d REPLACE which does the di r t y work. It receives as "argument" the JPEXPE which i s to replace the current one. The message currently being processed (and a l l other messages l e f t to process from the o r i g i n a l message form) i s then matched against patterns i n the replacement JPEXPR i n exactly the same way as they were i n the o r i g i n a l using the same execution instance, complete with a l l the patterns that are there already. The only changes made to t h i s execution instance are f i r s t , the current stack i s emptied; and second, an additional (EX-INSTANCE-OF ex-instance REPLACEMENT-J PEXPR) pattern i s added. This way of replacement allows results that have already been computed and asserted to be saved; moreover, the two execution instance pointers l e t the processing access information from either of the two "ISA" JPEXPRs, the old one or the replacement one. In the current example the execution instance INQUIRE-1 which i s used to answer the EXPECT message to INQUIRE would have i t s stack emptied and have a (EX-INSTANCE-OF INQUIRE-1 YES2) pointer added. The model would then try to match the message (EXPECT YES 2 TICKET-S ELLER1 SELF (PURPOSE SELF * UNKNOWN*) 7NEW-UTT) against patterns of YES2 as f o r a normal message; that i s , YES2 becomes the new subgoal. Chapter V 174 5.5.3 YES2 YES2 (see Appendix II) i s the speech act which handles the s p e c i f i c inquiry "yes?" When i t receives the EXPECT message, i t looks to see whether an utterance has been read. It has, since before the replacement took place INQUIRE had managed to do the reading of the words and t h i s r e s u l t has been saved i n the current execution instance which i t s e l f has been saved by REPLACE. Having thus already done the check for associatively a c t i v e JPEXPRs, the processing continues immediately to asserting the speaker of and the l i s t e n e r to the speech act. Having determined the conversants, the speech act then proceeds to interpret the utterance. In this case that merely involves looking for the words "YES" and "?" in order and alone i n the input utterance {this hasn't been done yet top-down by YES2, only bottom-up). I f they are not found, then the input i s not considered to be a YES2 so a f a i l u r e pattern i s l e f t i n the execution instance, and the match f a i l s . The f a i l u r e to match processing which ensues may f i n d a matching EXPECT pattern elsewhere {for example possibly the INQUIRE EXPECT pattern would be r e - i n s t i g a t e d ) ; but, i f not, then the f a i l u r e pattern should provide valuable information to explanation procedures in the " c a l l i n g " jPEXPR i n determining what went wrong and what to do about i t . In the happy event that the words "YES" and "?" are found, then this i s indeed a YES2 speech act. I f somebody says "yes?", then he i s asking what you want, supposing that you already know. Thus, the "meaning" of YES2 i s the expected Chapter V 175 content and this i s so indicated by asserting a pattern which i n t h i s case i s (CONTENT INQUIRE-1 (PURPOSE SELF *UNKNQWN*)). I f there i s no expected content, i . e . CONTENT has not been i n i t i a l i z e d during pattern matching, then the content defaults to (PURPOSE !LISTENER *UNKNOWN*); that i s , i t i s assumed that the speaker i s inquiring as to the unknown purpose of the l i s t e n e r . Once inter p r e t a t i o n has been accomplished, then the (jPROG ) i s done, so the newly endowed execution instance INQUIRE-1 i s returned as value, the entire pattern matches, and control resumes i n the c a l l i n g (PEXPR, in t h i s case the WHAT-D0-Y0U-BANT-1 s c r i p t i n s t a n t i a t i o n . Now, t h i s i n t e r p r e t a t i o n has been rather t r i v i a l : i n most cases much more complicated kinds of processing need to be done, so complicated i n fa c t that the speech act usually has to pass the buck to language-oriented processes that more or l e s s "parse" the input. For example i f INQUIRE (Appendix II) i s examined, i t can be seen that after the discovery of speaker, l i s t e n e r , etc. that to find the content of the utterance, INQUIRE sends an INTERPRET message to INQOIRE-CLAUSE i n order to extract meaning from surface l e v e l language., In the next section much more w i l l be said about this "language l e v e l " of the model»s processing. Before t h i s , however, l e t me conclude this section with a b r i e f discussion of the other major message type that speech acts handle: the EXECUTE message. For a regular action EXECUTE means to perform the action; s i m i l a r l y for a speech act. Thus, Chapter V 176 i f either INQUIRE or YES2 i s sent an EXECUTE message with the t r a d i t i o n a l speaker, l i s t e n e r , and content s l o t s f i l l e d , then i t i s up to the speech act to generate the utterance appropriate to the content (or some default verbalization i f the content i s unassigned). In the case of Y E S 2 , t h i s i s s i m p l i c i t y i t s e l f : the speech act merely c a l l s SPEAK-WORDS to print out the words "YES" followed by "?". SPEAK-WORDS, the generation analogue of HEAR-WORPS, must i n s e r t appropriate punctuation, ensure word ending agreement, and the l i k e . It currently works from a l i s t , but as with HEAR-WORDS, the eventual goal i s to put the words i n a pattern expression which can contain much meta-information having to do with the words, and have SPEAK-WORDS work with that. More complex kinds of generation are needed for most speech acts. Thus, INQUIRE sends a GENERATE message to the more language oriented INQUIRE-CLAUSE to produce the CONTENT. Generating an INQDIRE-CLAUSE requires cer t a i n s p e c i a l things (reversing word order, ensuring the choice of words for concepts i s appropriate, inserting a "?" at the end, making sure the output i s a clause complete with verb, subject, object, etc.) Of t h i s more i n the next section. One f i n a l note about EXECUTE: an EXECUTE usually results i n the assertion of CONTENT, SPEAKER, LISTENER, and SURFACE patterns s i m i l a r to those for EXPECT. Thus, in many ways execution instances that r e s u l t from the interpretation of utterances look i d e n t i c a l after they are done to those resulting from the production of utterances, a nice piece of symmetry. Chapter V 177 The other speech acts have s i m i l a r EXPECT and EXECUTE patterns associated with them. Although I don't want to go i n t o a f u l l fledged discussion of these acts, the main ISA-linkages connecting them are shown in Figure 5.6. 5.6 The Language Level Letting a s p e c i f i c speech act direct the interpretation or production of an utterance works very well i f expectations are precise enough. Unfortunately, i t i s the rare conversation which proceeds as expected, and even when expectations are more or l e s s met, there can be deviations in phraseology which can leave the speech act bewildered. Thus, i t i s that most int e r p r e t a t i o n and production i s done with the help of IPEXPRs whose expertise i s i n the area of language rather than i n the conceptual domain of the speech act which c a l l e d them i n . The c o l l e c t i o n of these |PEXPRs I c a l l the language l e v e l . The language l e v e l i s not, as yet, much more than a skeleton of the kinds of things that need to go on, so bear t h i s i n mind as you read the description. The language l e v e l here corresponds roughly to the syn t a c t i c l e v e l of processing. The differences w i l l become obvious as the description proceeds, but the major ones are that the syntactic constraints are very loose, that semantic processing i s interleaved throughout the syntax, and that there i s sometimes no need to use the language l e v e l at a l l (e.g. the speech act YES2 i t s e l f looks d i r e c t l y at the utterance). Chapter V 178 Figure 5_. 6^  -Speech Acts i n the Model 179 The general flow of control at the language l e v e l during in t e r p r e t a t i o n (in t r a d i t i o n a l top-down style) i s to breakdown an utterance into clauses, and then breakdown clauses into noun groups, verb groups, preposition groups, and sub-clauses (which are, i n turn, further broken down). Memory concepts representing the "meaning" of the noun groups, verb groups, and preposition groups are then b u i l t . These memory concepts are then linked together to y i e l d an interpretation of the clause of which they are a part. F i n a l l y , the clause interpretations are linked together to form an interpretation f o r the whole utterance which i s returned to the speech act f o r i t s perusal. The top-down breakdown of utterances i n t o groups i s si m i l a r to Winograd's (1972) parsing strategy; the amalgamation of groups via message passing has elements of a case approach (e.g. Taylor and Rosenberg (1975)). So, the language l e v e l i s concerned with p a r t i t i o n i n g an input utterance into sub-groups. To th i s end there i s a pattern expression for each: UTTERANCE, COORD-CLAUSE, SUB-CLAUSE, SEL-CLAUSE, NOUNG, VERBG, and PREPG. Of course, as always, there can be more s p e c i f i c groups which r e f i n e the processing of t h e i r superiors, for example a BECAUSE-SUB-CLAUSE, or even more s p e c i f i c a l l y a BECAUSE—I—HATE-CHEESE-SUB—CLAUSE. Figure 5.7 demonstrates an ISA hierarchy of such word group JPEXPRs. Word group JPEXPRs receive messages l i k e any other JPEXPRs. Two of p a r t i c u l a r i n t e r e s t are INTERPRET and GENERATE, the former to understand a conversant's words and the l a t t e r to produce words of the model's own choosing. In the following Chapter V 180 NOUNG VERBG LINGUISTIC-CONSTRUCT DEPENDENT-WORD- GROUP CLAUSE INDEPENDENT-WORD-GROUP PREPG REL-CLAUSE CLAUSE- CLAUSE-DEPENDENT INDEPENDENT SUB-CLAUSE COORD-CLAUSE UTTERANCE BECAUSE-SUB-CLAUSE BECAUSE-I-HATE-CHEESE- SUB- CLAUSE Figure S. 7_ - Word Group Hierarchy 181 discussion I w i l l concentrate almost exclusively on in t e r p r e t a t i o n even though the reverse problem of generation i s just as c r u c i a l to a good conversation. I f e e l that generation, and i t s attendent d i f f i c u l t i e s of concept - word t r a n s l a t i o n , s o p h i s t i c a t i o n in choice of words, pronoun replacement, syntactic well-formedness, etc., although i n t e r e s t i n g , i s too d i f f i c u l t to worry about in d e t a i l at the present time. 5.6.1 Interpreting UTTERANCES and CLAUSES UTTERANCES and CLAUSES are interpreted by being broken into constituents. These constituents can be NOUNGs, VERBGs, or PREPGs which are further interpreted as indicated in the next section, or sub-clauses, which are further interpreted into NOUNGs, VERBGs, and PREPGs. Certain clauses may have extra punctuation or conjunctions not incorporated into any group -these are merely noted and have use l a t e r when a clause i s asked how i t modifies some other concept (see below). A group i s asked to break i t s e l f down by sending i t a message of the form (INTERPRET language-level-|PEXPR ( l i s t of words) ?RESULT) For example, suppose a speech act has read and wants to in t e r p r e t t h i s utterance: "Beethoven composed the F i f t h symphony with extraordinary s k i l l . He was a great man." Then the speech act would send a message Chapter V 182 (INTERPRET UTTERANCE ("BEETHOVEN" "COMPOSE" "PAST" "THE" "FIFTH" "SYMPHONY" "WITH" "EXTRAORDINARY" "SKILL" n , i i I I H E H n B E n "PAST" "A" "GREAT" "MAN" ".«) ?RESULT-OF—INTERP) to UTTERANCE. The double-quoted atoms above are word |PEXPRs containing patterns l i n k i n g the word to i t s i n t e r n a l concept(s) and to i t s part of speech. To i l l u s t r a t e , "COMPOSE" might look somethinq l i k e <JPDEF "COMPOSE" (INSTANCE-OF "COMPOSE" VERB) (CONCEPT "COMPOSE" COMPOSE) > Upon receipt of an INTERPRET messaqe, UTTERANCE would divide the l i s t of words into two co-ordinate clauses and pass INTERPRET messages to each COORD-CLAUSE, i . e . (INTERPRET COORD-CLAUSE ("BEETHOVEN" ".") 7INTERP1) (INTERPRET COORD-CLAUSE ("HE" ".") 7INTERP2) Each of the COORD-CLAUSEs could be s p l i t into NOUNGs, VERBGs, PREPGs, or sub-clauses and i n t e r p r e t messages would then be sent to these constituents; e.g. (INTERPRET PREPG ("WITH" "EXTRAORDINARY" "SKILL") ?INT14) (INTERPRET VERBG ("COMPOSE" "PAST") ?INT12) Returned as a r e s u l t of any such interpretation i s a new |PEXPR representing the concept described by the NOUNG, VERBG, PREPG, or sub-clause. When a l l constituents of a clause have been interpreted, they must be linked together, so various pairs of them are sent MODIFY—HOW messages. Thus, the new IPEXPR representing the interpreted main verb of a clause may be asked how i t i s modified by the newly interpreted NOUNG just preceding i t ; e.g. (MODIFY-HOW VERBG-COMPOSE NOUNG-BEETHOVEN ?M0D-H0W1) Chapter V 183 In t h i s case, since Beethoven has a l l the c h a r a c t e r i s t i c s reguired of an agent for VERBG-COMPOSE (precedes the verb, i s animate, i s a composer), VERBG-COMPOSE would be happy to add to i t s e l f the pattern (AGENT VERBG-COMPOSE NOONG-BEETHOVEN) Si m i l a r l y , a NOUNG occurring after the VEEBG might be incorporated by asking VEEBG-COMPOSE (MODIFY—HOW VEEBG-COMPOSE NOUNG-SYMPHONY 7MOD-HOW2) which, since symphonies have a l l the q u a l i t i e s needed to be a patient for the verb group would result i n VEBBG-COMPOSE adding (PATIENT VEBBG-COMPOSE NOUNG-SYMPHONY) Note the case aspects of MODI FY—HOW processing: the newly created verb concept (probably using an inherited MODIFY-HOW procedure) i s making a l l the decisions about what to check f o r , what patterns to add, and what other processing to carry out. Other NOUNGs, PBEPGs, and REL-CLAUSEs are s i m i l a r l y linked into the NOUNGs or VERBGs which they modify. In addition two clauses may have to be linked together. For a COORD-CLAUSE and a SUB-CLAUSE, the message would be to the concept representing the dominating COORD-CLAUSE, i . e . (MODIFY-HOW COORD-CLAUSE-concept SUB-CLAUSE-concept 7MOD-HOW3) while for two COORD-CLAUSEs, the message would be to the concept representing the f i r s t COORD-CLAUSE. In cases involving PREPGs, SEL-CLAUSEs, SUB-CLAUSEs, or dominated COORD-CLAUSEs, the l i n k i n g word {preposition, r e l a t i v e conjunction, subordinate conjunction, co-ordinate conjunction, or punctuation mark) i s a v a i l a b l e . I t thus can be accessed during MODIFY-HOW processing Chapter V 184 to add precision to the link-up. For example, the clause "I l i k e stereo because i t beats mono." breaks into two clauses that are interpreted, say, as CGORD-CL AUSE-LIKE and SUB-CLAUSE-BEAT. As a resu l t of int e r p r e t a t i o n , SUB-CLAUSE-BEAT would contain a pattern (SUB-CONJUNCTION SUB-CLAUSE-BE AT "BECAUSE") so that when COORD-CLAUSE-LIKE t r i e s to see how SUB-CLAUSE-BEAT modifies i t , t h i s pattern can be accessed, and the pattern (REASON COORD—CLAUSE-LIKE SUB-CLAUSE-BEAT) can be added to COORD-CLAUSE-LIKE (REASON being the meaning of "BECAUSE" in t h i s context). After a l l constituents of a CLAUSE or UTTERANCE are connected, the interpretation of the CLAUSE or UTTERANCE i s complete, so the concept associated with the main verb i s returned to whoever wanted the CLAUSE or UTTERANCE interpreted (another clause or utterance, or a speech act). This i s because the main verb, so central in a l l HODIFY-HOS processing, and thus linked so cl o s e l y to the rest of the concepts, i n a sense represents the central meaning of any clause or utterance. Throughout t h i s processing, the CLAUSE and UTTERANCE JPEXPRs must, on the way down, make choices as to how to divide up words into appropriate sub-groups and, on the way back up, must decide on an order in which to try to rel a t e the sub-groups to one another. To make such decisions, t r a d i t i o n a l parsing expertise must be augmented by the a b i l i t y to look into the execution environment for information such as the speech act which i n i t i a t e d the proceedings (an INQUIRE speech act, f o r Chapter 7 185 example, might suggest an interrogative grammatical construction) or the conversant models (to, perhaps, suggest i n d i v i d u a l p e c u l i a r i t i e s of phraseology). I f , despite t h i s information, a mistake i s made, the CLAUSE or UTTERANCE must be able to try al t e r n a t i v e s . 5.6.2 Interpreting NOUNGs, VERBGs, and PREPGs NOUNGs and VERBGs represent concepts i n memory. Thus, a VERBG usually stands for some r e l a t i o n ; a NOUNG for some r e a l world or abstract object. The basic interpretation strategy for any such group i s therefore to produce a new pattern expression which represents the concept stated i n the group. NQUNGs: The interpretation of NOUNGs can best be described with an example. Assume that NOUNG i s sent a message to interpret ("THE" "FIFTH" "SYMPHONY"). The f i r s t thing done i s to f i n d concepts that are candidates for the meaning of each word (using the words' (CONCEPT ) patterns). In the case of multiple candidates for a word, the NOUNG makes some choice, perhaps based on the importance of the concept to the word i f such i s ava i l a b l e . (Of course, the NOUNG must be prepared to make another choice i f the f i r s t one f a i l s to work out). After doing t h i s "dictionary look-up", the NOUNG picks o f f the concept associated with the head noun (say SYMPHONY) and adds the pattern (ROLE-INSTANCE-OF NOUNG-SYMPHONY SYMPHONY) Chapter V 186 to the current execution instance (called N00"NG-SYMPHONY here) ; that i s , the execution instance i s playing the "role" of SYMPHONY i n t h i s context., Although i t i s debateable whether ROLE-INST ANCE-OF i s the appropriate pointer name to use here, I f e e l i t i s more convenient to use an already existing link type with an inheritance feature b u i l t i n (since much information relevant to the new concept w i l l have to be inherited from SYMPHONY as well as from NOUNG). Of interest i s that when future generations look at NOUNG-SYMPHONY, they w i l l know by the EX-INSTANCE—OF pointer that i t is a NOUNG, by the ROLE-INSTANCE-OF pointer that i t represents the concept SYMPHONY i n t h i s p a r t i c u l a r " r o l e " , and f i n a l l y by the EX-ENVIRON pointer the context i n which the words were issued. Next, the NOUNG must take care of a l l modifiers {adjectives, c l a s s i f i e r s , determiners, etc.) i n the group. Thus, the concept FIFTH (associated with the adjective "FIFTH") i s sent a message (MODIFY-HOW FIFTH NOUNG-SYMPHONY ?M0D-H0W7) i . e . how does FIFTH modify a new role instance of SYMPHONY? FIFTH, as are a l l adjective concepts, i s responsible f o r knowing how i t modifies concepts., FIFTH knows that i t i s the f i f t h number of whatever i t modifies, so i t adds (NUMBER-OF NOUNG-SYMPHONY 5) to NOUNG-SYMPHONY. I f the modification means that NOUNG-SYMPHONY i s now recognized to be a role instance of some more s p e c i f i c JPEXPR (e.g. FIFTH-SYMPHONY), then the old ROLE-INSTANCE—OF pointer i s removed and a new one added that Chapter V 187 points to the more s p e c i f i c }PEXPR. This, too, i s done by the adjective concept during receipt of a MODIFY-HOB message. NOUNG-SYMPHONY now resumes execution and checks i f there are any other modifiers in the group. Indeed there i s one more: the determiner "THE". The concept associated with "THE", THE, i s sent (MODIFY-HOH THE NOUNG-SYMPHONY 7MOD-HOH8) THE performs an analysis s i m i l a r to that for adjectives except that the main task of a determiner i s to determine whether the noun group i s a role instance of a new instance or merely a r o l e instance of an old instance. The usual case with THE i s that i t designates an old instance (although not always). In fact here THE does s i g n i f y that NOUNG-SYMPHONY i s a role instance of an existi n g instance, so THE proceeds to try to find the instance: the candidates are instances of SYMPHONY or i t s subsets. I f THE i s able to f i n d the p a r t i c u l a r symphony that f i t s (perhaps using some sort of jPEXPR comparison technigues such as those sketched out i n Chapter VI), for example BEETHOVEN-SYMPH—FIVE, then a (ROLE—INSTANCE-OF NOUNG-SYMPHONY BEETHOVEN—SYMPH—FIVE) i s added to NOUNG-SYMPHONY and the ROLE-INS TA NC E-OF pointer to SYMPHONY i s removed. More l i k e l y here, the decision as to the instance w i l l probably depend on further i n t e r p r e t a t i o n , so that (ROLE-INSTANCE-OF NOUNG-SYMPHONY fSYMPHONY) i s added to NOUNG-SYMPHONY (i.e. NOUNG-SYMPHONY i s a rol e instance of some subinstance of SYMPHONY yet to be determined) and the old ROLE-INSTANCE—OF pointer i s removed. Later, when other pieces of information become available, t h i s pointer can Chapter V 188 be further s p e c i f i e d . A f i n a l note: i f a NOUNG refers to a new instance (as i s usually the case with the a r t i c l e "A"), then the new instance i s created (using the EXPR CREATE-NEW) and the ROLE-INSTANCE-OF pointer i s directed to t h i s new instance. VERBGs: Verb groups are handled much as are noun groups: the execution instance created when VERBG i s sent an interpret message i s a role instance of some particular action concept associated with the main verb of the verb group. Adverbs and a u x i l i a r i e s i n the group further specify the time of the action, the manner of the action, the importance of the action, etc. To handle t h i s , the concepts associated with verb modifiers are sent MODIFY-HOW messages which r e s u l t i n extra patterns adorning the verb group execution instance. PREPGs: A preposition group i s interpreted by separating out i t s object noun group and i n t e r p r e t i n g i t . An additional pattern (PREPOSITION NOUNG-ex-instance »prepostion") i n d i c a t i n g the prepostion that heads the PR EP G i s asserted i n the NOUNG's execution instance (and l a t e r used, perhaps, during MODIFY-HOW processing). The NOUNG execution instance i s then returned as the "meaning" of the PREPG. Chapter V 189 5.6.3 Generation E a r l i e r I promised to at l e a s t mention the g e n e r a t i o n of ut t e r a n c e s at the language l e v e l . I w i l l g i v e here o n l y a b r i e f s u g g e s t i o n of what I have i n mind. A speech a ct r e c e i v e s an order {EXECUTE SPEECH-ACT SPEAKER LISTENER CONTENT ?OUT-WORDS) where CONTENT i s e i t h e r a JPEXPR name or a l i s t of JPEXPR names r e p r e s e n t i n g the concept to be spoken. The speech a c t can sometimes d i r e c t l y output the CONTENT (as f o r THANKS, say, or YES2), but most o f t e n i t must c a l l on the language l e v e l UTTERANCE, CLAUSE, NOUNG, VERBG, e t c . JPEXPRs to help i t produce n i c e output. Thus, INQUIRE probably needs t o use a subset o f UTTERANCE, INQUIRE-UTTERANCE perhaps, to generate i t s output. INQUIRE-UTTERANCE would thus be sent a message (GENERATE INQUIRE-UTTERANCE CONTENT ?OUT) In response i t would be expected to take the CONTENT d e s c r i p t i o n c o n t a i n i n g one or more JPEXPRs and f i g u r e out what p a t t e r n s i n the 1PEXPRs t o v e r b a l i z e and what t o l e a v e n o n - v e r b a l i z e d { t h i s would r e g u i r e , among other t h i n g s , the examination of the b e l i e f models f o r the model i t s e l f and the conversant, a v a i l a b l e i n the ex e c u t i o n environment). For each p a t t e r n that i s t o be v e r b a l i z e d , s u b - c l a u s e s , a d j e c t i v e s , adverbs, p r e p o s i t i o n groups, must be c o n s t r u c t e d , and these must modify verbs and nouns i n proper groups. Thus, at v a r i o u s stages PREPG, COORD-CLAUSE, SUB-CLAUSE, NOUNG, VERBG, e t c . can be sent GENERATE messages. When the time comes to get s u r f a c e words f o r i n t e r n a l Chapter V 190 concepts, patterns such as (SURFACE BUY "BUY") associated with the concept JPEXPRs can be used. As each clause or group i s completed, the words i n that conglomeration are returned in a l i s t to be amalgamated into other words returned from other clauses or groups. Eventually, words are returned to the speech act, which, using SPEAK-WORDS, outputs them. Obviously, t h i s i s a very b r i e f outline of the potential of the model i n the d i f f i c u l t task of generation. Much further analysis needs to be done before any claims can be made in t h i s area. For a good description of the problems that lurk i n generating natural language output, read Wong (1975). S> •I Conversations II and III So far the pr i n c i p l e s behind one pa r t i c u l a r conversation, the t i c k e t buying dialogue, have been i l l u s t r a t e d . However, at the beginning of the chapter two other conversations, the drink buying episode and the conversation with a " f r i e n d " at intermission, were proposed f o r analysis. I do not intend to do very much explanation here because the basic p r i n c i p l e s have already been presented and the complexities of the t h i r d conversation have not yet been s u f f i c i e n t l y well analyzed for detailed discussion. However, i t i s e s s e n t i a l to demonstrate the generality of the approach outlined i n the previous discussion. The drink buying episode takes place as STEP7 of the Chapter V 191 ATTEND—CONCEET plan (see Appendix II) after the model has l i s t e n e d to the f i r s t half of the concert and gone out for a break at intermission. I t turns out to be almost i d e n t i c a l to the t i c k e t buying episode: BOY i s c a l l e d with SELF as the agent, and with the desired drink being computed by asking PEE—DINNEE—DRINK (see Appendix II) the question (WANT SELF (DRINK SELF ?DESIRED-DRINK)). Since the model i s attending a concert, PRE-DINNER-DRINK computes the model's desires to be a new instance, JOHNNY—WALKER—SCOTCH 1, of the JOHNN Y-WALKER—SCOTCH J PEXPR (see Appendix I I ) . JOHNNY-WALKER-SCOTCH i s , i n turn, a subset of SCOTCH (see Appendix I I ) . Thus, the ITEM to BOY i s JOHNNY-WALKER-SCOTCH1. BOY then i s EXECOTEd and i t finds the location of the drinks (QETBAR, discovered by askinq JOHNNY-WALKER-SCOTCH1 which i n h e r i t s i t from PRE-DINNER-DRINK which computes i t by askinq for the location of the BAR at the location of the current event). The model goes to QETBAE where i t expects to f i n d the s e l l e r of JOHNN Y-WALKEE-SCOTCH1 to be a new instance, BARTENDER1, of BARTENDER (see Appendix I I ) . This knowledge has been inherited by JOHNNY-WALKER-SCOTCH 1 from the generic ALCOHOLIC—DEINK j PEXPR (see Appendix I I ) . The people in Figure 5.8 are thus known to the model. The BOY-CONVERSATION s c r i p t i s then EXECOTEd exactly as i n the t i c k e t buying episode to achieve the desired drink. As for t i c k e t buying, bargaining positions must be obtained. The bargaining positions f o r BARTENDER1 can be determined by asking BARTENDER 1, which i n h e r i t s i t from BARTENDER by accessing the Chapter V SELF f i g u r e 5 . 8 - P e a p _ i e 193 EXCHANGE pattern t h e r e . The b a r g a i n i n g p o s i t i o n s f o r the model ar e determined by asking SELF what i t wants to exchange, and t h i s i n f o r m a t i o n i s i n h e r i t e d along ROLE-INSTANCE-OF l i n k s from SELF-AS-A—BUYER—OF-ALCOHOLIC-DRINKS i n t h i s s i t u a t i o n . Thus, the model owns SELF-HAS-DRINK-BARGAIN I NG-POSN and wants i n exchange SELF—WANTS—DRINK-BARGAINING-POSN while the bartender has BARTENDER—HAS-BARGAINING—POS N and wants i n exchange BART ENDER—WANTS—B ARGAINING-POSN ( a l l these " b a r g a i n i n g p o s i t i o n " jPEXPRs are i n Appendix I I ) . I f i s i n t e r e s t i n g t o note the network form o f the v a r i o u s b a r g a i n i n g p o s i t i o n s known to the model, d i s p l a y e d i n F i g u r e 5.9. The two BARGAIN s u b - s c r i p t s o f BUY-CONVERSATION {see s e c t i o n 5.4.3) are once again the most i n t e r e s t i n g a s p e c t s of the s c r i p t . The f i r s t matches SELF-WANTS—DRINK-BARGAINING—POSN with BARTENDER—H AS-BARGAINING-POSN and the second matches BART ENDER-WANTS-BARGAINING—POSN with SELF—HAS-DRINK-BARGAINING-POS N. The f i r s t b a r g a i n i n g d i f f e r s from the t i c k e t buying i n t h a t two t h i n g s must be s e t t l e d , namely the brand, then the mixer {see the BARGAIN-ORDER p a t t e r n ) . The second b a r g a i n i n g s e t t l e s the c o s t of the d r i n k s much as d i d the t i c k e t buying s i t u a t i o n . The speech act and language l e v e l jPEXPRs are more or l e s s the same as i n the t i c k e t buying s i t u a t i o n so need not be delved i n t o here. A c o n v e r s a t i o n very s i m i l a r t o the t i c k e t buying c o n v e r s a t i o n c o u l d be produced: Chapter V 194 BARGAIN1NG-POSN ^ BARTENDER-HAS- TICKET-SELLER- TICKET-SELLER- / BARTENDER-WANTS -BARGAINING-POSN HAS-BARGAINING- WANTS-BARGAINING- BARGAINING-POSN POSN POSN Figure 5.9 - Bargaining Positions 195 {WHAT-DO-YOU-WANT-2} Bartender: "Yes?" Model: " I would l i k e a s c o t c h , please." [BARGAIN-3} Bartender: "What brand?" Model: "Johnny Walker." Bartender: "O.K." "What mixer would you l i k e ? " Model: "On the r o c k s . " Bartender: " F i n e . " {BABGAIN-4} Model: "How much i s t h a t ? " Bartender: "3 bucks." Model: "3 bucks! Wouldn't 2 d o l l a r s be more l i k e i t ? " Bartender: " A l r i g h t , I guess 2 d o l l a r s would do." Model: "That's b e t t e r . " [EXCHANGE-2} (hands over 2 d o l l a r s ) Bartender; "Thanks." (hands over the drink) Model; "Thank you." f FAREWELL-2} "So l o n g . " Bartender: "Au r e v o i r . " Chapter V 196 Upon completion of t h i s conversation, the ATTEND-CONCEBT pattern expression resumes execution at STEP8 where the model in p a r a l l e l f i l l s i n time and drinks i t s drink u n t i l i t hears the buzzer marking the end of intermission. This p a r t i c u l a r set of subgoals has only been added to show the |DO-PABALLEL |EXPB (see Appendix I) i n operation and the p o s s i b i l i t y of the model doing several things at once. Presumably the FILL-IN-TIME |PEXPB i s a very l i b e r a l plan which more or less allows bottom-up suggestions to di r e c t i t as to how to pass the time i t i s to f i l l . Thus, i f model "sees" an i n t e r e s t i n g mural on the wall, FILL-IN-TIME might decide to build and c a l l a subplan to go look at the mural, or i f the model i s a smoker, FILL-IN-TIME might invoke a subgoal to l i g h t up a pipe. But the s i t u a t i o n of i n t e r e s t here involves the model encountering a " f r i e n d " . At t h i s point FILL-rlN-TIME would have to f i r s t of a l l recognize the f r i e n d and bring in i t s model of the fri e n d , and secondly discover some sc r i p t which would enable the model to talk with the person. Exactly how thi s would be accomplished i s not c l e a r ; presumably, the (potential) bottom-up and associative c a p a b i l i t i e s would be strongly employed (see Chapter VI for somewhat more d e t a i l here) i n doing both tasks. At any rate, assuming the conversant model and the s c r i p t have been b u i l t , what would such a s c r i p t look l i k e ? I t would probably st a r t with some sort of greeting s c r i p t akin to wHAT-DO—YGU-WANT which would launch the conversation, to be followed by the most general two-person s c r i p t DIALOGUE (whose code i s in Appendix I I ) . The DIALOGUE s c r i p t expects SPEAKER 1 Chapter V 197 to produce some speech act, then S P E A K E R 2 to perform some speech act, then S P E A K E R 1 , and so on, u n t i l a f a i l u r e occurs. Note that a s p e c i a l f a i l u r e checking routine c a l l e d CHECK-FAILURE-DIALOGUE i s used that would explain a lack of input by suggesting that DIALOGUE i s done rather than as an error as CHECK-FAILURE might do. COMPUTE-EXPECTATIONS i s used to discover what to say at any stage based on what the speaker has said {available from the script ) , what he believes (available from his b e l i e f model) , what the other speaker has said, what the other speaker believes, and on the model's knowledge about the various topics of discussion (contained in objects accessible i n searches from iPEXPRs whose names can be found in the execution environment). This i s , of course, e x t r a o r d i n a r i l y d i f f i c u l t , and I can at best speculate on how i t would work. Probably one of the major ways of deciding on what to say amongst the multitudinous p o s s i b i l i t i e s i s to compare patterns i n one speaker's b e l i e f model with those i n the other's model, and also to compare the i r b e l i e f s with their utterances i n the conversation to date. Depending on th e i r attitude towards one another, either contradictions or s i m i l a r i t i e s could be emphasized in choosing amongst the comparisons. I f the two parties are i n an adversary position (e.g. in a debate), then important contradictions would be c r u c i a l ; i f the two are i n a co-operating mood (e.g. in purchasing something), then important s i m i l a r i t i e s would be emphasized; i f one person i s i n authority over the other (e.g. i n a job interview), the subservient one Chapter V 198 would be co-operative, the authority would be perhaps contrary; and so on. Some of the ideas in my f i r s t progress report (McCalla (1973)) would be relevant here. In any event, some sort of general conversation takes place, i s concluded, the model and the conversant exchange farewells, and the model returns from FILL-IN-TIME to the execution of the ATTEND-CONCERT plan. The plan continues with the model l i s t e n i n g to the second half of the concert, then going back home. Control at l a s t returns to the execution of WORLD-VIEW where some other plan must be constructed and undertaken. Thus, "one day in the l i f e " of the model has been presented. Hopefully, some idea has been gained as to the scope of the representation scheme, the type of language processing I envisage, and the problems which arise in using jLISP to undertake the processing. In the next chapter I would l i k e to discuss some of the generalizations which can be extracted from these examples, and then indicate some of the ways the system can be extended to handle other kinds of phenomena than those met so f a r . , Chapter V 199 CHAPTER VI Generalizations and Extensions The examples of the l a s t chapter indicate i n d e t a i l how the various parts of the model f i t together. In t h i s chapter I would l i k e to discuss some of the more general representation features that I see i n the model, to suggest what the model means for the analysis of language, and to i l l u s t r a t e some potent i a l extensions to t h i s kind of system. 6.1 Representation Properties of the Model Chapter V has exposed a plethora of patterns, pointers, and macros which together define the relevant information i n the model. A su r p r i s i n g l y small number of dimensions have suf f i c e d to delineate the bulk of this information. I would l i k e to investigate the following major categories: the ISA hierarchy, the PART-OF hierarchy, the execution environment, "one-shot" r e l a t i o n s , and procedural knowledge. 6-1-1 The ISA Hierarchy The ISA hierarchy consists of pattern expressions connected by INSTANCE-OF, ROLE-INSTANCE-OF, EX-INSTANCE-OF, or SUPERSET pointers. It i s the standard generalization hierarchy (e.g. Q u i l l i a n (1969), Levesgue (1977), Fahlman (1975), Roussopoulos (1976)) which allows lower concepts to i n h e r i t information from concepts higher i n the hierarchy. Chapter VI 200 It i s generally a property of the ISA hierarchy that the higher up a jPEXPR i s , the less s p e c i f i c i s i t s information since (potentially) many sub-JPEXPRs can i n h e r i t from i t . Thus, with JOHNNY-WALKER-SCOTCH i s very s p e c i f i c information as to the cost, the brand, etc.; with i t s superset, SCOTCH, i s more general knowledge about mixers that go with Scotch, and the model's preferences among Scotches; with SCOTCH'S superset PRE-DINNER-DRINK i s more general information yet about the contexts in which the model wants to drink pre-dinner drinks; with i t s superset ALCOHOLIC-DRINK i s the rather broad knowledge that bartenders serve al c o h o l i c drinks; and so on up the hierarchy. Of course, i t i s always possible (although the examples have not shown i t ) to override any general information by placing more s p e c i f i c information lower down i n the hierarchy; e.g. (MIXER yTEACHERS—SCOTCH tWATER) in TEACHERS-SCOTCH would be an exception to the general "scotch-mixer" being i c e . Inheritance occurs during pattern matching when a source pattern has f a i l e d to match any target patterns.. I f t h i s happens i t i s possible to look into the ISA environment surrounding the target object for a matching pattern. There are at l e a s t a couple of inter e s t i n g aspects to this kind of ISA inheritance: <i) information i s only inherited when i t i s needed (that i s only when somebody else t r i e s to access i t ) ; and ( i i ) whether a pattern i s inherited i s dependent on the type of information which the pattern represents ( i . e . the head Chapter VI 201 of the pattern determines what to do i f there i s a f a i l u r e to match). The examples of Chapter V i l l u s t r a t e at least two types of ISA inheritance which for the sake of convenience I w i l l label d i r e c t ISA inheritance and dependency ISA inheritance. Direct inheritance occurs when the f a i l e d source pattern ( i . e . the pattern for which no match has been found in the target object) i s d i r e c t l y matched to patterns i n the ISA environment without modifying the source pattern. Thus, i n the drink-buying episode when i t becomes important to discover the SELLER of the newly created SCOTCH1, the source pattern (SELLER SCOTCH ?WH0) i s constructed, and an attempt i s made to match i t i n SCOTCH 1. This f a i l s , so SELLER directs that the INSTANCE-OF pointer to JOHNNY-WALKER-SCOTCH be followed, where a direc t match i s undertaken for a pattern matching the source. This also f a i l s , so the SUPERSET pointer to SCOTCH i s followed (and another f a i l u r e to match occurs), the SUPERSET pointer to PRE-DINNER—DRINK i s followed (and s t i l l another f a i l u r e to match occurs), and f i n a l l y i t s SUPERSET leads to ALCOHOLIC-DRINK. There, the pattern (SELLER fALCOHOLIC-DRINK fBARTENDER) i s discovered which matches (SELLER SC0TCH1 ?SHO) d i r e c t l y since SELLER = SELLER, SCOTCH 1 i s a SUB-INSTANCE of ALCQHOLIC-DBlNK, and ?WH0 matches fBARTENDER by creating a new instance of BABTENDEB, say BART EN DER1, that i s bound to WHO i n the source object. Thus, the pattern (SELLER fALCOHOLIC-DBINK fBARTENDER) has been i n some sense " d i r e c t l y " inherited by SCOTCH 1. This i s f a i r l y t y p i c a l of most d i r e c t l y i n h e r i t a b l e Chapter 71 202 patterns; they are usually r e l a t i o n s that pertain to instances (indicated by M t w ) but that are stored with classes. Thus, the c l a s s ALCOHOLIC-DRINK contains the pattern (SELLER */ALCOHOLIC-DRINK fBARTENDER) that the SELLER of any sub-instance of ALCOHOLIC-DRINK i s a sub-instance of a BARTENDER. The pattern expressions of Chapter V are f u l l of such patterns. Of i n t e r e s t i s that the use of =( ) macros allows the placement of a r b i t r a r y procedural conditions on inheritance just as " f " imposes the condition of "sub-instance of" on i t s element. The other kind of inheritance, dependency inheritance, involves modifying the source pattern as ISA l i n k s are traversed. This most freguently occurs when the item being inherited i s a property of the class i t s e l f rather than being a property of the instances of the c l a s s with which i t i s stored. The second element of the pattern i s , thus, usually the class name and when a sub-class (or instance) i s trying to i n h e r i t the pattern i t must take into account t h i s f a c t . The most commonly inherited such patterns are the "procedural patterns" designated by EXECUTE, EXPECT, INTERPRET, etc. which are associated with their containing JPEXPR regardless of whether or not i t i s an instance. For example i f the message pattern (EXECUTE ATTEND-CONCERT SELF CONCERT 1 ?ATT EN D-RESULT) were sent to ATTEND—CONCERT, and there was no matching pattern, EXECUTE would be c a l l e d i n to suggest what to do. EXECUTE patterns are dependently inheritable with the second element Chapter VI 203 being dependent on (in f a c t egual to the name of) the (PEXPR which contains the pattern. So, i n this case the ATTEND |PEXPR (SUPERSET to ATTEND-CONCERT) would be contacted and would be searched for a pattern matching the modified source (EXECUTE ATTEND SELF CONCERT 1 7ATTEND-RESULT) and i f t h i s f a i l e d , the superset of ATTEND, say PLAN-OF—ACTION, would be searched for a pattern matching (EXECUTE PLAN-OF-ACTION SELF C 0 NC ER T1 ?ATTEND—RESULT). The next most common si t u a t i o n reguiring dependency matching i s when an execution instance or role instance i s i n h e r i t i n g from an instance or another execution instance or role instance. In t h i s case any references to the execution instance or role instance must be considered to be dependent, at l e a s t u n t i l the instance i s encountered. Thus, i f RUFF-1 i s an execution instance of RUFF, a pattern (HOWL RUFF-1) would be modified to (HOWL RUFF) when searching RUFF. Note that, although the match i s dependent when going from RUFF-1 to RUFF, i t would be direct i f the search were carried out i n the ISA environment above RUFF, since t h i s i s above the instance l e v e l . Dependency matches i l l u s t r a t e what a powerful feature i t i s to force the semantics of f a i l u r e to match processing to be e x p l i c i t l y stated i n the pattern head, since the pattern head can do anything appropriate to the kind of information represented i n patterns of that kind. In fact, i t would even be possible to do away with pattern elements such as n t " and l e t the pattern head r e a l i z e that the r e l a t i o n i t represents connects instances rather than classes. In t h i s way the (PEXPR Chapter VI 204 SELLER would know that (SELLER ALCOHOLIC-DRINK BARTENDER) would r e l a t e instances of the classes specified by the second and thi r d elements, rather than the classes themselves. I f e l t , however, that t h i s was putting too much power into the pattern head, and i t would be better to suggest via macro modification the conditions on various elements i n a pattern. This i s just another procedural / declarative tradeoff. 6*1.2 The PART-OP Hierarchy The PART-OF hierarchy connects pattern expressions by the pointer PART-OF. As with the ISA hierarchy, t h i s l i n k has been recognized as being important (see, for example, Levesgue (1977), Havens (1977)). A JPEXPR, Y, i s connected by PART-OF to another JPEXPR, 2, i f the " r e a l world" referent f o r Z i s an aggregate consisting at least i n part of the " r e a l world" referent for Y (e.g. a pattern (PART-OF LEG-OF-ROFF RUFF) i n RUFF) . As with ISA searches, PART-OF searches can be carried out i n response to a f a i l u r e to match; for example i n the case of certa i n " a t t r i b u t e " patterns such as (COLOUR ) or (TEXTURE ), etc. where the attribute of the part i s l i k e l y to be the same as the a t t r i b u t e of the aggregate. Moreover, such searches should be c a r r i e d out with dependency PART-OF inheritance i n force, i f applicable. Thus, to f i n d a pattern matching the source (TEXTURE LEG-OF-RUFF ?WHAT) might reguire patterns i n LEG-OF-RUFF to be considered, then, i f t h i s f a i l e d , patterns i n RUFF. The source would have to be changed to Chapter VI 205 (TEXTURE RUFF ?WH AT). PART-OF i s also instrumental i n intersection searches, that i s searches where i t i s necessary to see i f several JPEXPRs are a l l PART-OF some more general JPEXPR. For example i n the discussion of how the model updates i t s LOCATION pointer (section 5.3.2), PART-OF int e r s e c t i o n was used to determine the l e v e l of geographic d e t a i l affected by a change in the model's position. Many other uses can be envisaged. Interestingly, there i s a s i m i l a r necessity for ISA i n t e r s e c t i o n . For instance i t i s necessary in the semantic portions of the language l e v e l to check whether certain word concepts in t e r s e c t up ISA l i n k s with the concept ANIMAL (i.e. to see i f something i s animate). For many examples of t h i s phenomenon! see Q u i l l i a n (1969) and Fahlman (1975). 6 . 1 . 3 The Execution Environment The execution environment i s accessed from any particular execution instance by following EX-ENVIRON pointers to execution instances of higher l e v e l goals. Patterns can be matched i n the execution environment (using direct matching techniques) i f they represent the type of information which changes as subgoals are undertaken. Thus, the LOCATION of the model, the current object on which the model's ATTENTION i s focussed, and the l i k e , would reguire looking up EX—ENVIRON pointers i f necessary. In addition the execution environment forms the basic context mechanism of the model in that i t focusses the model's attention on the things relevant to the current goals. Thus, at Chapter VI 206 the language l e v e l , the model can discover the current speaker by looking into the execution environment for the c o n t r o l l i n g speech act where a pointer to the relevant model of the speaker i s recorded. Knowledge gained from t h i s model may enable the current utterance to be more eas i l y interpreted or generated than i t would be without the contextually relevant speaker model. This i s a f a i r l y t y p i c a l use of the execution environment: execution instances in i t contain patterns pointing to relevant jPEXPRs which i n turn contain patterns pointing to s l i g h t l y less relevant |PEXPBs further away from the execution environment, and so on. It is in t h i s sense that i t i s a context mechanism. Thus, contextually relevant things are those things that you can get at from the current execution environment. Deciding when to put something into the execution environment then becomes the major problem; so that in the example above how did the conversant model get activated in the f i r s t place? There i s no hard and fast rule about putting things into the context, but by far the most common way i s for a s c r i p t , or plan, or whatever to know d i r e c t l y by name the "foregrounded" jPEXPR to choose. The next most common way i s by simple search up ISA or EX-ENVIRON lin k s for data of certain kinds (e.g. to f i n d {SELLER T I C K E T 1 ?WH0) look up EX-ENVIRON pointers). Sometimes other searches can be used, as was the case when top-down expectations used associative activation (combined with ISA intersection) to exclude without top-down consideration the YES 1 affirmative answer meaning of "YES". Many more p o s s i b i l i t i e s Chapter VI 207 e x i s t . The important point about context i s that i t may be hard to decide on what to make relevant, but once something i s included in the execution environment, much more work i s saved by the elimination of useless information than was spent on the i n i t i a l decision. It i s usually worth the e f f o r t to spend a l o t of energy now to save a l o t more l a t e r . Execution environments also form the basis f o r a sort of episodic memory, consisting of p a r t i c u l a r l y relevant execution environments incarnated when the model was achieving previous goals. These old episodes not only s t i l l maintain t h e i r EX-ENVIRON and EX-INSTANCE-OF pointers, but they also s t i l l contain a l l other relevant patterns that were asserted during t h e i r active existence. Thus, accessing an old execution instance allows the e n t i r e context in which i t was run to be seen as i t was then, with the exception, of course, that i t i s being viewed from the changed perspective of the current context. This gives a f a c i l i t y s i m i l a r to the ALINK / CLINK d i s t i n c t i o n of Bobrow and wegbreit (1973) frames i n that i t allows something to be executed i n one context and returned to another. Moreover, i t extends t h i s d i s t i n c t i o n , since i t i s perfectly possible to have an execution instance of an execution instance of an execution instance, and hence have three l e v e l s of context. If the execution instance were created as a subgoal of an EVENT-SEQUENCE, there w i l l be a THEN l i n k connecting i t to the next subgoal at i t s l e v e l . Thus, old episodes are often stored Chapter VI 2 0 8 as graphs looking something l i k e Figure 6.1. Various episodic memory searching procedures could be visu a l i z e d (EX-ENVIRON searches from some execution instance; Scans from execution instance to execution instance along THEN l i n k s ; searches along THEN l i n k s with EX-ENVIRON searches at each stage; etc.) Which of these, i f any, would be best would depend on the reasons for undertaking the search. Since episodic memory hasn't been actualized in the examples I have considered, further d e t a i l as to i t s properties w i l l have to await more elaborate experimentation. It i s int e r e s t i n g to note that the three organizational p r i n c i p l e s outlined thus far give the model the a b i l i t y to view things at varying l e v e l s of d e t a i l ; that i s , JPEXPRs lower down are i n some sense more detailed than those higher up i n each dimension. Thus, i n the ISA hierarchy, lower JPEXPRs are of more s p e c i f i c type than higher JPEXPRs; i n the PART-OF hierarchy, lower JPEXPRs are more s p e c i f i c parts of higher JPEXPRs; and i n the execution environment, lower |PEXPRs are more s p e c i f i c goals of higher JPEXPRs. Such levels of d e t a i l allow the model to focus in on things i n greater and greater s p e c i f i c i t y i f necessary. Being able to view things at di f f e r e n t l e v e l s i s of great usefulness i n many places, in deciding how much d e t a i l to keep in episodic memory, i n deciding how much needs to be verbalized i n the generation of utterances, etc. Rowat (1974) has a f u l l e r discussion of the usefulness of the l e v e l of d e t a i l concept. Chapter VI 2 0 9 Figure 6^. 1_ - An Episode in Memory 210 6.1..4 One-Shot Relations There are a number of " r e l a t i o n s " i n the model which form no coherent organizational p r i n c i p l e (as the ISA, PART-OF, and EX-ENVIRON pointers do) but which are c r u c i a l . I c a l l these "one-shot r e l a t i o n s " since they don't connect to one another i n long chains as do ISA, PART-OF, or EX—ENVIRON. I think here of concepts such as COMPOSER, SELLER, BUYER, CONCEPT, SURFACE, AGENDA, etc., which constitute the major portion of the model's knowledge base. These " r e l a t i o n s " in their very m u l t i p l i c i t y i n d i c a t e that the model i s not based on universal primitives but rather that any convenient domain dependent "primitives" can be chosen, can be endowed with a relevant name, given appropriate semantics (in what they do re f a i l u r e to match, in how many elements patterns headed by them take, i n IF-ADDED or IF-REMOVED processing, e t c . ) , and used appropriately. 6.1.. 5 Procedural Knowledge The f i n a l important aspect of the model's memory organization are the overtly procedural patterns in the memory. Thus, EXECUTE, EXPECT, INTERPRET, ASSOC, ... a l l designate patterns which undertake most of the model's active processing. The eventual hope i s to slowly cut down on the number of COND, CDR, CAR, CONS, ... primitives and submerge them in t o higher l e v e l "knowledge-based" primitives. This would not only cut down on the s i z e of these patterns and make them more readable, but would also go a long way towards making the model self-examinable ( i t i s unimaginable r i g h t now for the model Chapter VI 211 i t s e l f to look at most procedural patterns with a view to understanding what they do). As was mentioned in the section on ISA i n t e r s e c t i o n , the second element of these patterns designates the j PEXPR which contains the pattern. This i s because such patterns are properties of the |PEXPR i t s e l f rather than any r e a l world referent of the jPEXPR. The following main types of procedural pattern have been used thus f a r : Top-Down Patterns: (i) EXECUTE: The main top-down aspect of the model, such patterns are used to undertake the "action" of the containing JPEXPR i f the intended actor i s the model i t s e l f . Thus, an EXECUTE sent to ATTEND-CONCERT puts in t o action the concert plan; an EXECUTE sent to a speech act w i l l have the model speak the act; and so on. (ii) EXPECT: The "dual" to EXECUTE, t h i s kind of pattern i s used when somebody else i s expected to do the action. I f somebody other than the model were to EXCHANGE an item with the model, then the model would EXPECT i t ; i f the conversant were to undertake a speech act, then the model would EXPECT i t . The close relationship that sometimes exists between EXECUTE and EXPECT can be i l l u s t r a t e d when i t i s realized that an EXPECTed GIVE of a t i c k e t from the t i c k e t s e l l e r to the model could be almost eguivalent to the model EXECUTEing a TAKE of a t i c k e t from the t i c k e t s e l l e r . Chapter VI 212 Language Patterns: (i) GENERATE: This type of pattern i s just the EXECUTE f o r the language l e v e l , distinguished from EXECUTE because t h i s i s a more t r a d i t i o n a l name i n language processing, and also because GENERATE patterns do not take the speaker or l i s t e n e r as "arguments". (ii) INTERPRET: This i s the EXPECT f o r the language l e v e l , distinguished from EXPECT for reasons similar to those given for the EXECUTE / GENERATE d i s t i n c t i o n . ( i i i ) MODIFY-HOW "case" procedures: These are the case s t y l e messages (elucidated i n section 5.6) to be used to check the semantic relationships among l i n g u i s t i c concepts. Patterns Associated with Pattern Heads: (i) IF—ADDED: This procedural pattern i s associated with 1PEXPRs that can be used to designate the head of a pattern. Whenever a pattern i s asserted, i t s head i s asked i f there are any IF-ADDED "by-products" which need to be done. (ii ) IF—REMOVED: This procedural pattern i s s i m i l a r l y invoked to take care of side-effects r e s u l t i n g from the removal of a pattern. ( i i i ) FAILURE-TO-MATCH: This procedural pattern i s associated with JPEXPRs that can be used as pattern heads and i s c a l l e d into play when a pattern with the appropriate head has f a i l e d to match i n some JPEXPR (in a sense t h i s makes i t an IF-NEEDED method). I t i s thi s kind of pattern which determines whether inheritance, inference, or something else e n t i r e l y must Chapter VI 2 1 3 be undertaken i n an attempt to overcome the f a i l u r e . Other Procedural Patterns: (i) ASSOC: This pattern type contains the procedural information that i s necessary when a | PEXPR i s contacted i n a non-goal-directed way. One example of t h i s was indicated i n Chapter V where the YES2 speech act replaces INQUIRE because of A s s o c i a t i v e information. More non-top-down message types would be needed to handle sensory input, bottom-up PART-OF amalgamation, etc. {see section 6.3.4 for more d e t a i l s of how t h i s might work and how ASSOC messages allow demons to be incorporated into the model). (i i ) context dependent patterns: Any pattern can contain a procedural element (such as or " t " or " ! " ) , especially when i t i s necessary to encode context dependent information. The examples of the l a s t chapter i l l u s t r a t e d many such patterns (e.g. ROLE-INSTANCE-OF, drink preferences, bargaining po s i t i o n s ) . 6.2 L i n g u i s t i c A b i l i t i e s of the Model In t h i s section I would l i k e to summarize the l i n g u i s t i c a b i l i t i e s of the model as displayed in Chapter V. One of the two main thrusts of the l i n g u i s t i c analysis has been to view language as just one more a c t i v i t y i n which the model can engage, a view which leads to the consideration of l i n g u i s t i c goals i n the same terms as the model's other goals. The other Chapter VI 214 major thrust has been to blur the d i s t i n c t i o n s among the morphemic, syntactic, semantic, and pragmatic l e v e l s of analysis (at least as to when the knowledge i s applied), and to replace them with d i v i s i o n s that more closely correspond to the knowledge being represented. The combined consideration of these two underlying philosophies has resulted i n the breakdown of language into the s c r i p t l e v e l , the speech act l e v e l , and the language l e v e l . Moreover, within each l e v e l can be sub-divisions which further promote the fundamental aims of the model. 6.2.1 Scripts The highest l e v e l of the model's l i n g u i s t i c c a p a b i l i t i e s are s c r i p t s . above s c r i p t s i n the model's goal hierarchy are non - l i n g u i s t i c plans of action; below s c r i p t s are speech acts. S c r i p t s (a term borrowed from Schank and Abelson's work (1975)) represent stereotyped conversational s i t u a t i o n s . Scripts contain the speech acts expected to be uttered by each speaker and co-ordinate the inter p r e t a t i o n and production of the actual utterances when they come along. Monologues, dialogues, monologues about dialogues, multiple person conversations are a l l possible; the model i t s e l f can be i d e n t i f i e d with any, a l l , or none of the roles in a s c r i p t . There are a plethora of s c r i p t s delineated in Chapter V, some of them in guite a b i t of d e t a i l . Thus, there are BUY-CONVERSATION, wHAT-DO-YOU-WANT, BARGAIN, and even the very general DIALOGUE s c r i p t which expects only that two people w i l l Chapter VI 215 alternate speech acts. Despite their apparent variety, s c r i p t s have several common c h a r a c t e r i s t i c s . When i t i s desired to undertake a s c r i p t s processing, i t i s sent an EXECUTE message with pattern elements including the conversant models (ticket s e l l e r , s e l f , bartender) f o r each of the expected speakers. These conversant models can be used by the s c r i p t (and i t s subgoals) to help in understanding what the conversant means by what he says by focussing on the contextually relevant speaker knowledge. (Note: i f an EXPECT message i s sent to a s c r i p t , i t most often i s equivalent to sending an EXECUTE messaqe since the s c r i p t keeps track of a l l roles i n either mode; e.g. EXPECTing SELF to take part in a BUY-CONVERSATION with OTHER i s the same as EXECUTEing a BUY-CONVERSATION between SELF and OTHER.) When a s c r i p t i s EXECUTEd, i t i s responsible for directing a conversation according to i t s expectations as to how the conversation should proceed. To t h i s end, i t must spawn sub-scripts (as does BUY-CONVERSATION for example) containing portions of the conversation, or i t must c a l l i n speech acts (as does 1HAT-D0-YOU-WANT) to d i r e c t l y process utterances of i n d i v i d u a l conversants. These subgoals are interleaved i n appropriate sequence; that i s , the s c r i p t i s the primary seguencing f a c i l i t y i n the model. A s c r i p t i s also responsible f o r checking that each portion of the conversation has indeed gone as planned., I t must therefore check f o r overt f a i l u r e s (e.g. i n a b i l i t y to fin d a match for a message pattern or inappropriate subgoal being Chapter VI 216 chosen) and also for more subtle f a i l u r e s (e.g. the content of an utterance i s not as expected or v i o l a t e s the information contained in the conversant model). If discrepancies are found they must be explained i n some say (try another goal, f a i l the s c r i p t , ignore the discrepancy) . BARGAIN i l l u s t r a t e s t h i s best when i t must extract the actual bargaining stance of a conversant from the conversant*s utterance and use t h i s i n preparing i t s expectations f o r the next utterance. A s c r i p t has one f i n a l major task: to keep a record of the conversation to date and t i e the current utterance into t h i s record. This i s actually very complex since the current utterance might add s i g n i f i c a n t l y to what's gone on before, might even influence the interpretation of previous utterances to a large extent. Right now, t h i s t i e i n g - i n i s very simple: the s c r i p t merely keeps track of the seguencing of the execution instances of i t s subgoals so that any information contained therein can be retrieved. Clearly this needs much work. §.*2.2 Speech Acts Speech acts are the l e v e l of l i n g u i s t i c description concerned with producing or understanding a single utterance. The examples of Chapter V i l l u s t r a t e a few of the relevant speech acts: INQUIRE, RESPOND, etc. To see the kinds of things which speech acts do, the following should help. A speech act receives an EXECUTE message from a s c r i p t when i t i s to produce an utterance of the appropriate kind; an EXPECT message when i t i s to comprehend an utterance. Usual message Chapter VI 217 elements include models of the conversants and the expected content of the speech act (where content i s some pattern representing the basic rel a t i o n s h i p that i s the primary subject of the speech act). Upon receipt of an EXPECT message, the speech act i s reguired to understand an utterance. I t , thus, must read i n the surface utterance from the input buffer (some bottom-up morphological analysis and idiom aggregation could already have occurred). It then analyzes the words i n the utterance i n the hopes of producing a CONTENT description of them. This analysis can be done d i r e c t l y by the speech act (as YES2 does), or may reguire i t to ask language l e v e l pattern expressions to help i n t e r p r e t the utterance (as INQUIRE does). The CONTENT description produced should mesh with the expected CONTENT (else some sort of explanation would be reguired). As with s c r i p t s , a speech act may need to match information gleaned from speech with information i n a conversant model to see i f what a speaker says corresponds to what he believes. If the speech act has received an EXECUTE message, then i t i s to produce surface words corresponding to the speech act and i t s CONTENT. This may be done d i r e c t l y or with the help of the language l e v e l generation processes. Once surface words are constructed, the speech act must actually print them (a process which could reguire morphological "cleaning up" of the utterance before i t i s actually printed). Regardless of whether i t ran i n EXECUTE or EXPECT mode, the speech act when done w i l l have asserted four patterns of Chapter VI 218 importance (SPEAKER ) (LISTENER ) (CONTENT ) (SURFACE — ) where the CONTENT i s given and messages and vice versa for pattern p a r t i c u l a r l y i s used discerning the meaning of a patterns are also available. SURFACE produced for EXECUTE EXPECT messages. The CONTENT by s c r i p t s (e.g. BARGAIN) i n speech act, although a l l other 6.2.3 The Language Level The language l e v e l does much of the t r a d i t i o n a l syntactic and semantic processing of the model. The domain dependent modularity which has been of central concern to the representation of knowledge i s not violated by the existence of t h i s l e v e l because the domain of t h i s l e v e l i s language i t s e l f . This i s emphasized by the f a c t that the pattern expressions at t h i s l e v e l have l i n g u i s t i c names such as UTTERANCE, NOUNG, PREPG, CLAUSE, etc. These JPEXPRs must interpret or generate the actual words i n an input utterance and thus must know about the surface relationships that e x i s t among words and also the relationships which e x i s t among concepts associated with words. Analogously to a speech act's reception of EXPECT or EXECUTE, a language l e v e l JPEXPR receives INTERPRET or GENERATE messages. An INTERPRET message i s sent when the JPEXPR i s to produce a CONTENT description from a l i s t of words passed as an element of the message pattern. A GENERATE message i s sent when the |PEXPR i s to produce a l i s t of words f o r some CONTENT Chapter VI 219 description passed as an element of the message pattern. Neither type of message has the conversant models included, although these are available via the (SPEAKER ) or (LISTENER ) patterns i n the execution environment, i f necessary. Ifiter£retation : A language l e v e l |PEXPR can be c a l l e d in by some speech act to interpret a l i s t of words (obtained by the speech act from the conversant or separated out by a higher language l e v e l J PEXPR). The |PEXPR does dif f e r e n t things depending on what kind of J PEXPR i t i s : (1) NOUNGs and VERBGs stand for single concepts in the memory, so break down no further. These particular groups consist of some head (the noun or verb) and a l l words modifying t h i s head (adjectives, determiners, c l a s s i f i e r s , adverbs, e t c . ) . The basic idea in interpreting such a group i s to create a new 1PEXPR to represent the concept and to endow i t with patterns appropriate to i t s meaning. The new [PEXPR i s deemed (at lea s t i n i t i a l l y ) to be a ROLE—INSTANCE-OF the concept represented by the head. It i s then further s p e c i f i e d by sending a HODIFY-HOW message to the concept associated with each modifier asking i t how i t modifies this new 1PEXPR. When the group i s f u l l y processed, the new |PEXPR i s returned to the c a l l i n g |PEXPR. (2) CLAUSES and UTTERANCES represent r e l a t i o n s among NOUNGs, VERBGs, and other assorted grammatical constructs, so the subgroups must f i r s t be interpreted before the re l a t i o n can Chapter VI 220 be properly assessed. To t h i s end, the words are broken down in t o subgroups each of which i s sent an INTERPRET message and returns a new j PEXPR representing the meaning of the subgroup. The new JPEXPRs are then brought together using appropriate HODIFY-HOW messages. Once a l l subparts have been linked together the main verb concept (the |PEXPR containing the information content of the CLAUSE or UTTERANCE) i s returned. Several i n t e r e s t i n g aspects of interpretation i n the approach to language discussed here derive from the fact that surface language i s interpreted into new JPEXPRs. These JPEXPRs are l i k e any other so can receive messages such as MODIFY—HOW with equanimity; however, since they i n i t i a l l y contain very l i t t l e except ROLE-INSTANCE-OF, EX-INSTANCE-OF, and EX-ENVIRON pointers, the response to such messages must be inherited. Another advantage of representing newly interpreted concepts i n jPEXPRs i s that the concepts can be e a s i l y modified by adding new patterns as more information i s found at any time during the inte r p r e t a t i o n ; or by deleting old patterns as previous assumptions are revealed to be f a l s e ; or by changing old patterns as more precise information becomes available. The use of macro elements i n patterns, furthermore, allows decisions to be postponed u n t i l the necessary information i s found (such as, fo r example, using a " t " macro when i t i s known that a noun group refers to a s p e c i f i c instance of a concept, but not enough information i s yet known to determine exactly which instance). Another in t e r e s t i n g aspect of int e r p r e t a t i o n i s that i t combines a top-down parsing d i s c i p l i n e with a case approach. Chapter VI 221 The top-down part enters when utterances and clauses are broken down into constituent subgroups before interpretation. The case part enters when concepts associated with certain kinds of words (verbs, adjectives, adverbs, etc.) are asked how they modify other concepts. This i s n ' t unlike Taylor and Rosenberg's (1975) case-based parser which does an ATN pre-parse to grossly group the words, and then follows t h i s with a case analysis. Generation: When a language l e v e l | PEXPR i s sent a GENERATE message with some content (either a pattern or a JPEXPR) as an element, the { P E X P R i s being asked to produce words corresponding to the content. If CLAUSE receives such a message, fo r example, i t i s to produce a clause appropriate to the content; i f NOUNG receives such a message, i t should produce a noun group. Thus, i f the content were (CHASE DOG CAR) , then a CLAUSE might produce "The dog chases the car." but a NOUNG might generate "the dog who chases the car". The problems of how much to verbalize, choice of surface words, what subgroups to break things down into, and the l i k e , are very d i f f i c u l t and would reguire the model to have access to the conversant models, utterance to date, and non-linguistic goals ( a l l available in the execution environment). However, since a serious attack on the problems of generation i s beyond the scope of the thesis, there has been no analysis of how t h i s would be accomplished. Chapter VI 222 6.3 Possible Extensions In t h i s section I would l i k e to suggest several possible a d d i t i o n a l feature which would enable the model of the l a s t chapter to to handle a wider and more interesting array of problems than i t does currently. Some of these extensions involve figuring out how to use features already provided by JLISP; other extensions require, i n addition to t h i s , an actual expansion of J L I S P ' S a b i l i t i e s . The suqqestions here are meant to be evocative of the kind of things that would be needed, rather than to be riqorous proposals with s o l i d solutions. 6.3.1. Beta Patterns Beta patterns are patterns which contain labelled patterns Within them. JLISP, as was seen in Chapter I I I , has the a b i l i t y to encode such patterns using ":" macros to l a b e l patterns and macros to refer to these patterns. The model of Chapter V made minimal use of such patterns; c l e a r l y , many more such patterns would be necessary i f the model were to be t r u l y sophisticated. (i) IffPs: Hinograd (1975) t a l k s about designating certain important patterns as IMPs. ,. Already seen in Chapter V have been IMPs such as S3 : (IMPORTANCE SELF /S1 9) SH : (IMPORTANCE SELF /S2 4) where S1 and S2 are patterns such as 51 : (COST yTICKET-FOR-CONCERT f DOLLARS- 5) 52 : (COST JTICKET-FOR-CONCERT fDOLLARS-10) One possible extension of IMPs i s to even higher order nestings: Chapter VI 223 S5 : (IMPORTANCE SELE /S3 4) Another possible extension i s to di f f e r e n t kinds of IMPs. Thus, as w i l l be seen shortly i n the discussion of |PEXPR comparison, i t would be possible to designate certain patterns as being core patterns of a |PEXPR, (CORE JPEXPR-name (/S1 /Sn)) i n that they are used i n comparison and others aren't. These •would be si m i l a r to Becker's (1969) c r i t e r i a l concepts and to the d e f i n i t i o n a l concepts discussed by Woods (1 975). But, such a binary d i s t i n c t i o n i s s t i l l , perhaps, too s i m p l i s t i c and even more subtle d i s t i n c t i o n s of r e l a t i v e importance among patterns may be needed. For example, psychological markers such as those proposed by Tesler et a l (1968) could be incorporated as meta patterns such as (CHARGE SELF /S1 9) (SIGNIFICANCE SELF /S1 7) (i i ) sequencing: There are many places where the sequence of some set of things i s a key factor. Thus, the pattern matcher could be told to follow some seguence i n choosing a target pattern; the conversation to date (in the script) could be kept as a seguence of elements, etc. This could be indicated using sequence patterns: (SEQUENCE MATCH JPEXPR-name (/S1 /S2)) (SEQUENCE CONVERSATION JPEXPR-name {/S2 /S1)) showing that the pattern matcher should try to match pattern S1 then pattern S2, but that S2 preceded S1 i n the conversation., ( i i i ) time: The myriad problems involved i n handling time Chapter VI 224 have been, by and large, ignored. The only reference to anything having to do with time has been the JTIME-LIMIT= and j TlME-NOW= patterns used by JLISP in the processing of interrupts. C l e a r l y , i t would be advantageous to be able to keep track of various kinds of time; the time when the model undertook various tasks, the time of int e r n a l events i n the processing (interrupts, garbage c o l l e c t i o n , e t c . ) , the time of events mentioned i n discourse ( h i s t o r i c a l time, the time of occurrence of various things i n a story or movie). To t h i s end, JPEXPBs could be devised to represent various clocks (timers, i n t e r n a l clocks, h i s t o r i c a l clocks, story c l o c k s ) . Such clocks would be responsible for keeping track of events relevant to them in time units appropriate to the events (seconds, days, eras). They could be queried for the time of occurrence of these events, could be sent messages to update themselves, and so f o r t h . Meta patterns could be employed to record times associated with other patterns. Thus, (TIME ASSEBTION WOBLD-VIEW—CLOCK27 /S1 2 96) might indicate the time of assertion of pattern S1 to be 296 according to some i n t e r n a l clock c a l l e d WOBLD-VIEW-CL0CK27. (TIME OCCOBBENCE TIME-LINE3 /S1 PAST) might show that the event represented by the pattern SI occurred i n a PAST era according to TIME-LINE3; but (TIME OCCOBBENCE TIME—LINE2 /S1 FOTOBE) indicates that the same event occurred in a FOTUBE era from the perspective of TIME-LINE2. Time i s an i n t e r e s t i n g area needing Chapter VI 225 much further exploration (see Kahn (1975) or R. Cohen (1976) for a thorough elaboration of the problems of time). 6.3.2 Garbage C o l l e c t i o n and Learning Because many of the "temporary" j PEXPRs (execution instances, new instances, etc.) set up during processing turn out to be useful l a t e r i n episodic and other considerations, throughout the thesis I've talked of the necessity for doing garbage c o l l e c t i o n i n t e l l i g e n t l y . To th i s end, a place has been reserved for a goaling hierarchy headed by META-VIEW that runs i n p a r a l l e l to the main-line WORLD-VIEW goals. I r e a l l y have no solutions to o f f e r , but can at least t r y to indicate the scope of the problem. The f i r s t task i s to clean up the excess baggage created during the WORLD-VIEW processing (and for that matter during the processing i n META-VIEW i t s e l f , although t h i s i s simpler since i t i s n ' t too important to keep around old META-VIEW episodes). Of spec i a l i n t e r e s t are execution instances, most of which are useless. My current i n t u i t i o n on th i s i s that a l l execution instances below a certain l e v e l of d e t a i l (probably the s c r i p t l e v e l i n language processing, for example) should be automatically destroyed (except, perhaps, i n exceptional circumstances when the most t r i v i a l d e t a i l s might remain v i v i d l y i n the system's memory). A general rule of thumb might be that i f i t hasn't been spawned as a subgoal of an EVENT-SEQUENCE, then i t i s n ' t worth keeping around, since the episode i s n ' t important enough to warrant being connected up with THEN l i n k s . This h e u r i s t i c has problems Chapter VI 226 (what happens i f an EVENT-SEQUENCE i s used in a subgoal of a non-EVENT-SEQUENCE?), and moreover ignores the f a c t that even many EVENT-SEQUENCE episodes should be destroyed. However, i t seems as good a s t a r t i n g point as any. Needless to say, once execution instances are destroyed, many other JPEXPRs w i l l f a l l by the wayside, since they w i l l be pointed to only from the now destroyed execution instances (e.g. perhaps new conversant models would be eliminated when the episode i n which they were created was destroyed). It should be remembered, furthermore, that each time a pattern i s removed during the destruction of an execution instance, i t s IF-REMOVED si d e - e f f e c t w i l l be c a l l e d to keep things consistent. Many execution instances created as a by-product of accessing b a s i c a l l y s t a t i c pieces of data from secondary JPEXPRs are not records of subgoals i n the same sense as are execution instances of primary JPEXPRs ca l l e d in as subgoals. Such "secondary" execution instances should also be destroyed eith e r using the EVENT-SEQUENCE c r i t e r i o n or, perhaps on the basis of having no "!" or "$" macros in the receiving pattern. Of in t e r e s t here i s the fact that t h i s kind of garbage c o l l e c t i o n i s unnecessary i f JPATTERN or |POINTER JEXPRs are used when accessing patterns believed to be s t a t i c . These JEXPRs "cheat" ( i . e . v i o l a t e modularity) by looking d i r e c t l y into pattern expressions to match patterns; and being JEXPRs, they create no new execution instances (using instead the current execution instance) and hence avoid the garbage c o l l e c t i o n problem by not creating any garbage in the f i r s t place. In any event, the Chapter VI 227 whole garbage c o l l e c t i o n problem i s a major one, barely explored as yet. META-VIEW must also help solve a related problem; i t must handle more subtle kinds of modifications which loosely f i t under the lab e l "learning". Already the examples have i l l u s t r a t e d the construction of new IPEXPRs (such as TICKET-SELLER1 and BARTENDER1) which are slowly endowed with patterns as knowledge about them i s gained. This adding of new information can be considered perhaps the most basic kind of learning. More sophisticated kinds would involve generalization (a l a Winston (1970)) up the ISA hierarchy. For example i f every instance of PERSON had a pattern (NUMBER-OF-LEGS instance 2) then the concept (NDMBER-OF-LEGS yPERSON 2) should probably be added to PERSON, and the patterns with each instance could be removed. The " f M macro would be used often as various s p e c i f i c elements i n instances were "abstracted out". Of course, there remain many d i f f i c u l t i e s here. Other more devious kinds of learning, involving such things as the construction of plans from old episodes, the discovery of reasonable kinds of explanations for f a i l u r e that can be incorporated into plans, or the l i k e , would also no doubt be a stock i n trade of META-VIEW, although t h i s sort of thing promises to be very, very hard. It i s a reasonable assumption that META-VIEW w i l l have to be at least as sophisticated as Chapter VI 228 WORLD-VIEW. Probably more so! 6 . 3 . 3 . Non-Goal Directed Processing Most of the model's processing has been goal directed. In th i s section I would l i k e to discuss three non-goal directed aspects {bottom-up processing, associative a c t i v a t i o n , and demons) and consider what effect they would have on the system. When words are read by the model, the actual words are not cont r o l l e d by any goal of the model but have an external source, •sing PART-OF l i n k s , they could (theoretically) be amalgamated into groups, into clauses, and perhaps even higher up, often without reference to any top-down goal. , Certain groups of words could even be c r i t i c a l parts of s c r i p t s and when they occur would strongly suggest that these s c r i p t s be activated. This i s c a l l e d bottom-up processing, and i t i s diametrically opposed to the strong top-down emphasis of the model. The guestion a r i s e s : where would bottom-up information meet top-down information? The top-down / bottom-up point could be fi x e d almost anywhere.. If the model were to expect an utterance, but had no further d e t a i l s , then the UTTERANCE J PEXPR would be sent an INTERPRET message, and no further strong top-down d i r e c t i o n need ensue. I f the model were to expect a pa r t i c u l a r kind of utterance (e.g. a "Because I ate the cheese." clause), on the other hand, i t could send the j PEXPR BECAUSE-I-ATE-THE—CHEESE an INTERPRET message to process the utterance from i t s own s p e c i f i c viewpoint. S i m i l a r l y , the bottom-up processing could amalgamate words into groups, into Chapter VI 229 clauses, and even suggest the relevance of c e r t a i n s c r i p t s or no n - l i n g u i s t i c goals. These bottom-up traces, however, would have to be integrated into some sort of top-down inter p r e t a t i o n of the world; and choosing which top-down jPEXPB to contact to do t h i s integration i s a problem I have not tackled, except to say the currently active execution instance. In any event, i t can be seen that top-down or bottom-up can go as far toward one another as they l i k e , a f l e x i b i l i t y that i s c r u c i a l for an i n t e l l i g e n t system. There are other places where non-goal directed processing must be taken into consideration. Whenever a JPEXPB i s activated top-down, many c l o s e l y connected JPEXPRs (perhaps JPEXPRs whose names are contained in patterns of the top-down j PEXPR) may be relevant. To discover which are relevant, (ASSOC ) messages would have to be sent out to spread an associative activation to nearby JPEXPRs (this i s s i m i l a r to Beiger's (1974) idea of inference waves spreading out from concepts). In responding to an ASSOC, a target JPEXPR would decide whether or not i t considered i t s e l f relevant (in which case i t would communicate i t s desire to be processed (and i n what way - EXECUTE, EXPECT, or whatever) to the top-down acti v a t i o n source) and also i t would need to decide to whom ( i f anybody) to spread the a c t i v a t i o n . There i s probably a need, as well, for JPEXPRs that act e s s e n t i a l l y as demons i n that they are created at one time f o r execution l a t e r when conditions are appropiate. Upon creation, such a demon would have an (ASSOC ) pattern i s added to i t . Chapter VI 230 containing the ac t i v a t i o n conditions for the demon along with the message i t i s to handle when i t i s activated ( a l l of t h i s w i l l l i k e l y be contained in some sort of procedural element i n the pattern). In addition, at creation, pointers (DEMON JPEXPR-i new-demon) to the new demon would be added to a l l jPEXPR-i considered to be relevant to i t s eventual activation. When any of these |PEXPB-i happened to be ca l l e d i n top-down, they would associatively contact the demon "new-demon" (because of the DEMON pointer) which can then decide whether or not conditions are r i g h t f o r i t to be activated top-down. I l l of these non-^goal directed aspects bring up the problem of what exactly the goal directed processes would do when confronted with bottom-up, associative, or demonic demands. The guick and d i r t y answer i s that bottorn-up, associative, or demonic information must be incorporated one way or another into the top-down context. For example, since a l l bottom-up information must eventually be given a top-down int e r p r e t a t i o n , sooner or l a t e r a l l words must be perused and incorporated i n t o some s c r i p t ' s view of the world. Of course, a bottom-up datum could be ignored completely i f the top-down goals were blinkered enough. Under other circumstances more primitive components of the bottom-up activation tree could be chosen even i f higher jPEXPRs were l i t up. In the s i t u a t i o n that bottom-up feedback does not mesh with top-down expectations, the top-down |PEXPR would be saddled with the responsiblity of explaining the d i f f i c u l t y . S i m i l a r l y , the presence of any non-goal directed Chapter VI 231 active (PEXPR which hoves into the view of any top-down (PEXPR must be explained or excused. The nature of these explanations and excuses i s beyond the scope of the thes i s . 6.3.4 Comparing ]PEXPRs In much of the model's processing, to talk to or about a pattern expression has reguired somebody else to know i t s name. In things l i k e recognition or associative a c t i v a t i o n , i n delineating ever more precise subinstances of concepts at the language l e v e l , and i n finding contradictions and s i m i l a r i t i e s between concepts as part of a non-directed conversation or a debate, i n a l l of these places i t becomes important to be able to compare entire pattern expressions to one another by content rather than merely by name. This i s a very d i f f i c u l t process when v i r t u a l l y no r e s t r i c t i o n s have been placed on what patterns can go into a |PEXPR, when the meta knowledge about a (PEXPR i s mixed in with the knowledge about the |PEXPR *s referent, when patterns are so varied in length and content, and when the presence of macro elements in patterns v i r t u a l l y eliminates any p o s s i b i l i t y of self-examinability or comparison with other patterns at the l e x i c a l l e v e l . These d i f f i c u l t i e s can be p a r t i a l l y overcome by the clever use of things l i k e meta patterns, but the r e a l solution w i l l not come u n t i l much more declarative r e a l i z a t i o n s of information can be devised to replace the a l l too frequent occurrence of long, procedural patterns. Following MERLIN (Moore and Newell (1973)), the fundamental Chapter VI 2 3 2 comparison technique might involve viewing one pattern expression as another. Thus, i t would be possible to view a dog as an animal, or a cat as a rock, or a car as a freight t r a i n , etc. The dire c t i o n i s important since to view a freight t r a i n as a car, a rock as a cat, an animal as a dog, i s guite a di f f e r e n t thing. The fundamental comparison rule outlined below i s based on the intersection technigue described in Q u i l l i a n ' s TLC (1969). The rule qoes as follows: Pattern expression A can be viewed as pattern expression B i f (i) B = A or i s in the ISA environment of A; or (ii) there i s some "nearby" pattern expression C i n the ISA environment of both A and B, and moreover each pattern i n A has a comparable pattern i n B. "Nearby" i s determined by counting the number of ISA l i n k s traversed from each jPEXPR before intersection i s achieved. The number of such l i n k s varies with the importance of the viewing. Two patterns X and Y are comparable i f for each atomic element E i n X there i s an atomic element F i n Y such that E can be viewed as F. These rules can be tuned, i f desired, to r e f l e c t a pa r t i c u l a r set of assumptions, as w i l l be seen i n the following examples. T r i v i a l l y , i f the jPEXPRs are RUFF and ANIMAL, then by "view-as" rule ( i ) , RUFF can be viewed as an ANIMAL. Next, assume the J PEXPR SMOKEY (a CAT) i s to be viewed as R0CK1 (a STONE). Thus, SMOKEY could be Chapter VI 233 (}PDEF SMOKEY (INSTANCE-OP SMOKEY CAT) 51 : (NOISE SMOKEY MEOW) 52 : (SHAPE SMOKEY FOUR-LEGGED) (CORE SMOKEY (/S1 /S2))) and ROCK1 could be represented as (|PDE? ROCK 1 (INSTANCE-OP ROCK 1 STONE) 51 : (NOISE ROCK 1 NOSOUND) 52 : (SHAPE ROCK! ROUND) {CORE ROCK 1 (/S1 /S2))) So, the command {VIEW-AS SMOKEY ROCK1) i s issued and the intersect i o n technique carried out resul t i n g i n an intersec t i o n at THING. Assuming t h i s i s near enough (i . e . not more than a user s p e c i f i e d number of ISA l i n k s have been followed), the search for comparable patterns begins. Comparing the respective S1 and S2 patterns, the following f i r s t - l e v e l viewpoint can be b u i l t : ()PDEF SMOKEY-VIEWED-AS-A—ROCK 1 (SUPERSET SMOKEY-VIEWED-AS-A-ROCK 1 VIEWPOINT) 51 : {NOISE ! {VIEW SMOKEY ROCK 1) ! (VIEW MEOW NOSOUND)) 52 : (SHAPE ! (VIEW SMOKEY ROCK 1) I(VIEW FOUR-LEGGED ROUND)) (CORE SMOKEY-VIEWED-AS—A-ROCK1 (/S1 /S2))) which can be reduced s t i l l further to (| PDEF SMOKEY-VIEWED-AS-A-ROCK 1 (SUPERSET SMOKEY-VIEWED—AS-A-ROCK1 VIEWPOINT) 51 : (NOISE SMOKEY-VIEWED-AS-A-ROCK1 ! (VIEW MEOW NOSOUND) ) 52 : {SHAPE SMOKEY-VIEWED-AS-A-ROCK1 '(VIEW FOUR-LEGGED ROUND)) (CORE SMOKEY-VIEWED-AS-A-ROCK1 {/S1 /S2))) since SMOKEY-VIEWED-AS-A-ROCK1 i s the resul t of executing the second elements' "!" - macro. Thus, SMOKEY can be viewed as R0CK1 i f a MEOW can be viewed as NOSOUND and FOUR-LEGGED can be viewed as ROUND. Clearly, each of these computations could be Chapter VI 2 3 4 carried out to get second-level viewpoints and so on. Much obviously has been l e f t unsaid here. F i r s t , "nearby" has been defined i n t h i s example to be guite far apart since the in t e r s e c t i o n at THING i s very high in the ISA hierarchy. The decision as to how many li n k s to traverse would depend on exactly how c r u c i a l the comparison i s i n the current context., Second, how did VIEW know that S1 and S2 were g r i s t f o r the comparison m i l l while the INSTANCE-OF and COSE patterns were not? The answer here harkens back to the COSE patterns mentioned i n section 6.3.1. Recall that the meta pattern {CORE ) defines which patterns are c e n t r a l to a JPEXPR. Thus, one way to r e f i n e the fundamental comparison rule i s to use only CORE patterns in the comparison. A further refinement of t h i s might also take into account c e r t a i n other meta information such as IMPs, etc., i n deciding which patterns to compare and which to leave alone. A t h i r d refinement i l l u s t r a t e d by the example i s the f a c t that the comparison was stopped at the f i r s t l e v e l of viewpoints rather than being carried out ad infinitum. The decision as to how far to go with t h i s would be dependent (i) on the degree of difference between the resultant views {e.g. i f MEOW and NOSOUND were to intersect at too great a distance, then further comparison might seem f u t i l e ) ; ( i i ) on the importance of finding a very refined match in the current s i t u a t i o n ; and ( i i i ) on the reluctance of the model to posit (a term from MERLIN) the necessary views rather than to produce a further l e v e l of viewpoints (e.g. without further search FODR-LEGOED could be Chapter VI 235 posited as ROUND). I l l these parameters could be s p e c i f i e d as arguments at the time of VIEW invocation. Much has not been i l l u s t r a t e d by the example. Primary among the no-shows i s the lack of procedural pattern elements. These might be handled by testing for LISP EQUALity; but t h i s seems a b i t s t i f f , and some way of comparing that i s more f l e x i b l e would be desirable. The eventual hoped-for reduction i n the number of such procedural patterns would c e r t a i n l y go a long way towards a l l e v i a t i n g t h i s problem. A second problem i s how to choose the B pattern to compare to the A pattern, something that i s f a i r l y easy i f a B pattern s t a r t i n g with the same head and of the same length as the A pattern can be found. If such a holy g r a i l cannot be discovered, the problem becomes i n f i n i t e l y more t r i c k y . If no comparable pattern i s found for A, then presumably some sort of pattern (NOVIEW PATTERN A) would need to be asserted i n the VIEWPOINT |PEXPR. Too many such unmatched patterns, especially i f they were IMPs, would be grounds f o r rejecting the whole VIEWPOINT. A related problem might be what to do about extra B patterns. Obviously the work on JPEXPR comparison i s i n a preliminary stage. Many issues have been ignored and even the ones that have been discussed have been only touched upon b r i e f l y . I f the model i s to be extended to recognition and other more general areas, JPEXPR comparison w i l l have to be confronted seriously. Chapter VI 236 6*3.5 Miscellaneous Extensions Clearly the system here s k i r t s other many intere s t i n g areas that could use further elaboration. Thus, what i s the nature of short term memory? I s i t the number of patterns i n a (PEXPB? Or the number of execution instances on the execute gueue? Or a separate short term memory where certain concepts must be placed before being considered? I don't have any idea except that short term memory seems a f a i r l y important concept and would perhaps be help f u l i n cutting down on the vast number of things being considered at any given time by the model. Another problem might be planning, that i s actually building such jPEXPBs as ATTEND-CONCEBT i n response to goals; deciding amongst many goals; deciding on what goals to undertake i n the f i r s t place., Once again I can at best speculate on these things. Work on so-called "analogical" representations, such as carri e d out by Funt (1976) and others, suggests that perhaps a place should be found for such a l e v e l of description. Adding a new kind of object <e.g. some sort of di r e c t representation of the Queen Elizabeth theatre or a motor-action) could be accomplished guite e a s i l y with minimal disruption to the interpr e t e r ; but deciding on what message passing semantics to enforce for the new object would be d i f f i c u l t . In sum t h i s would probably be more trouble than i t was worth, given the f l e x i b i l i t y and power of the current object d e f i n i t i o n s , i n pa r t i c u l a r the pattern expression. Chapter VI 237 This concludes the description of the generalizations and extensions. In the l a s t chapter, Chapter VII, I would l i k e to discuss the contributions and future d i r e c t i o n s of t h i s research. Chapter VI 238 CHAPTER VII Conclusion In the preceding chapters a scheme for representing knowledge was delineated and given computational description as a set of LISP-based control structures c a l l e d JLISP. Then, an approach to modelling conversation was described and a p a r t i c u l a r example i l l u s t r a t i n g the approach was detailed in terms of JLISP. In t h i s chapter I would l i k e to summarize the contributions and shortcomings of the representation scheme and the language model; I would then l i k e to conclude with some thoughts on how to improve and extend the ideas presented here. 1-1 Contributions to Representation The object centred representation allows a modularity which should enable large systems to be b u i l t . The pattern expression i n p a r t i c u l a r i s i n t e r e s t i n g in that i t comes i n so many guises: i t can be seen as an i n d i v i s i b l e primitive or as a node i n a semantic network or as an examinable set of patterns or as a b a s i c a l l y opaque procedural object. Often the same pattern expression can be viewed in any or a l l of the four guises, depending on circumstances. A pattern expression i s also interesting i n how i t responds to a message. The incoming message i s a pattern that i s matched Chapter VII 239 against patterns i n the jPEXPB body. The message pattern has exactly the same r e s t r i c t i o n s as the jPEXPB patterns so the pattern matching i s completely symmetric. Through the use of macros, the pattern matcher can be given instructions that can involve binding variables, computing something, or performing an action only under certain conditions. These a b i l i t i e s allow a decision as to exactly what a pattern means to be postponed u n t i l the information in the pattern i s needed, a useful a b i l i t y i n encoding context dependent knowledge. Because of macros, the user of the representation scheme also has the choice of whether to encode information in a b a s i c a l l y procedural way (using l o t s of macros) or in a b a s i c a l l y declarative way (using very few macros). In the early stages of any research (as in t h i s research, for example) i t may be easier to overemphasize procedural patterns at the expense of examinability, but t h i s should disappear as f a m i l i a r i t y with the domain increases. Moreover, the t r a n s i t i o n to more declarative patterns can be smooth since a l l patterns (macro-filled or macro-less) are accessed in a s i m i l a r fashion, using the same pattern matcher. Further contributing to the procedural / declarative intermixture i s the fa c t that the answers to a l l messages are themselves patterns containing v i r t u a l l y no macros and are l e f t i n the execution instance of the |PEXPB which received the message as declarative f a l l o u t of procedural a b i l i t i e s . One f i n a l feature of the pattern expression i s i t s c a p a b i l i t y of being "run" i n several d i f f e r e n t modes merely by Chapter VII 240 endowing i t with several di f f e r e n t patterns, one for each mode. Thus, i n the language example of Chapter V, speech acts could be run in EXECUTE, EXPECT, or ASSOC modes. This kind of a b i l i t y allows an object to encode a l l the information relevant to i t within i t . The "multiple mode" feature takes on added power when combined with the representation scheme's f a i l u r e to match processing. If a pa r t i c u l a r message pattern cannot be handled, the pattern head i s contacted for i t s advice. The user can specify that the pattern head i s to perform a r b i t r a r y inferences, buth t h i s would in general be explosive, so he i s encouraged (by the provision of spe c i a l search routines) to r e s t r i c t f a i l u r e to match processing to execution environment searches (for context dependent information) or to ISA searches (for information that can be inherited down a generalization hierarchy). This kind of f a i l u r e to match c a p a b i l i t y provides a way of performing procedural attachment (see Winograd (1975)); i t says that information i s inherited i f and only i f i t i s needed; i t says that the pattern head (usually acting as a relation) i s the foremost authority on what to do i n f a i l u r e to match si t u a t i o n s ; and i t adds robustness to the system. The representation scheme i s substantially enhanced because i t s execution instances are themselves JPEXPRs that don't disappear after execution. This allows them to be accessed using the same message passing paradigm as any other JPEXPR, a nice b i t of uniformity that turns out to be very useful i n episodic considerations (see below). Because of t h i s feature, Chapter VII 241 the power that an ALINK / CLINK d i s t i n c t i o n provides (Bobrow and Wegbreit (1973)) to execute in one environment and return control to another can be simulated without an e x p l i c i t d i s t i n c t i o n being made. That i s , a l l that i s needed i s an execution instance of an execution instance, one with an EX-ENVIRON pointer to one environment, the other with an EX-ENVIRON pointer to another environment. In fact, the a b i l i t y can be extended by having arb i t r a r y chains of execution instances, each with a d i f f e r e n t execution environment. F i n a l l y , keeping old execution instances around allows them to be used in pseudo-parallelism, where an old execution instance can be stopped and l a t e r resumed i n the exact same context i t was inhabiting before i t was halted. The execution environment of active execution instances i s b a s i c a l l y a LISP or ALGOL s t y l e dynamic context, but the f a c t that the execution instances in the environment are IPEXPRs that can contain patterns implies i t can be used i n a knowledge-based way. In p a r t i c u l a r , patterns that contain context dependent information (e.g. the i d e n t i t y of the conversants, the purpose of one of these conversants, the current focus of attention) can be stored and accessed. As the execution instance containing them i s backed through, they disappear from view. The execution environment thus provides a focussing mechanism. I t i s also useful i f the current goals of a system need to be accessed -the goals are strung upwards i n the execution environment, attached (via EX-INSTANCE-QF pointers) to the execution instances there. Chapter VII 242 But, perhaps the most int e r e s t i n g feature of execution environments arises i n combination with the examinability and non-disappearance of the execution instances contained there. This combination of features allows the construction of a sort of episodic memory (after Schank (1974)) consisting of trees of old execution environments. I f any p a r t i c u l a r execution instance i n t h i s environment i s picked out, the e n t i r e context i n which i t was o r i g i n a l l y active can be seen. Although the mechanics of how much of old execution environments to save and how to search them have not been worked out, this approach seems to be a promising conception of episodic memory and one that i s perfectly compatible with semantic memory (unlike Schank's (1974) arguments) since a l l execution instances have EX-INSTANCE-OF pointers to the "semantic" ISA environment as well as EX-ENVIRON pointers to the "episodic" execution environment. A f i n a l aspect of the representation scheme i s the fact that i t allows arbitrary l e v e l s of d e t a i l along several dimensions (ISA, PART-OF, the subgoals created by message passing). In addition IPEXPRs can be considered as unexpanded stubs with only a name, or can be opened to y i e l d a l l the d e t a i l s inside, whereupon the elements of the patterns residing there can be treated as names or opened (this i s a kind of "contained i n " hierarchy). This a b i l i t y means that a JPEXPR can always be broken down i f necessary into subcomponents of some kind, in direct opposition to the primary tenet of primitive based systems (Schank (1972) , Wilks (1973)). This seems an Chapter VII 243 absolutely e s s e n t i a l aspect of i n t e l l i g e n c e - the a b i l i t y to go into d e t a i l when necessary. 7.2 Contributions to Language Analysis The language model described i n Chapter V has served a dual r o l e : f i r s t , i t has acted as a test bed for JLISP; second i t has suggested a possible approach to modelling conversation. I would l i k e i n t h i s section to describe the main contributions I see the model making to the analysis of conversation and along the way suggest how JLISP has helped and influenced the construction of the model. The model i s founded on the b e l i e f that the problem of conversation must be treated as e s s e n t i a l l y a problem i n pragmatics. This viewpoint i s not unigue - i t i s argued persuasively by Winograd (1976) for example, and by the philosophers of language (Grice (1968), Searle (1969)), and by l i n g u i s t s such as Fillmore (1975) - but i t d i f f e r s markedly from t r a d i t i o n a l l i n g u i s t i c approaches. This view i s reflected in a couple of ways in the model: the i n d i s t i n g u i s h a b i l i t y of l i n g u i s t i c from n o n - l i n g u i s t i c goals (they are a l l JPEXPBs, and except at the language l e v e l a l l receive EXECUTE and EXPECT messages); and the emphasis i n the model on things l i k e s c r i p t s , speech acts, and conversant models rather than on more standard language aspects such as parsing, parts of speech, etc. The model's emphasis on goals i s not accidental. Other researchers (P. Cohen (1977), Levin and Moore (1977), the Chapter VII 2 4 4 philosophers of language) have suggested the importance of conversants' goals i n the interpretation and production of utterances, although the rather r i g i d h i erarchical structure of non- l i n g u i s t i c goals c a l l i n g s c r i p t s c a l l i n g speech acts c a l l i n g language l e v e l goals i s not emulated elsewhere. Aside from t h i s , the most i n t e r e s t i n g general features distinguishing the model are jllSP-based: the a b i l i t y to encode a l l goals as 1PEXPBs and run them i n EXECUTE mode (to produce utterances) or EXPECT mode (to understand utterances); the fact that from any goal a l l superior goals can be accessed i n the execution environment and that the execution environment acts as a focus for a l l l i n g u i s t i c endeavour; the usefulness of being able to abstract processes into the ISA hierarchy and l a t e r i n h e r i t them when necessary; the f a c t that execution instances at a l l l e v e l s can act as re p o s i t o r i e s of information and i n that way encode the "meaning" of the conversation. However, at each l e v e l there are interesting features. Non-linguistic goals drive other goals and form the context for a l l that follows. They can be accessed from a l l lower l e v e l s and are thus i n f l u e n t i a l on what i s said. Occasionally n o n - l i n g u i s t i c goals can be c a l l e d by l i n g u i s t i c goals (e.g. EXCHANGE c a l l s GIVE i n the Chapter V examples) as well as vice versa. This f l e x i b i l i t y i s c r u c i a l i n many l i n g u i s t i c s i t u a t i o n s (especially when language i s being used to aid i n the accomplishment of some task). The s c r i p t l e v e l i s int e r e s t i n g i n t h i s model because i t di r e c t s the entire conversation. Scripts are responsible f o r Chapter VII 245 spawning sub-scripts or speech acts, making sure they have run c o r r e c t l y (although the model has a t r i v i a l "explanation" component at the present time), and i n general keeping track of the sequencing of a conversation. Scripts also keep a record of the entire conversation by making assertions i n the execution instances (this, too, i s pretty t r i v i a l at the moment). Of p a r t i c u l a r note i s the f l e x i b i l i t y of s c r i p t s i n regard to the i d e n t i t i e s of the speaker: the model i t s e l f can be i d e n t i f i e d with none, one, or both of the conversants. There i s also no t h e o r e t i c a l l i m i t i n the model to having only two conversants (although no n-person conversations were given). The speech act l e v e l i s not nearly so central in the model here as i t i s i n , say, P. Cohen's (1977) work. Speech acts, nonetheless, form an in t e r e s t i n g interface between s c r i p t s and the language l e v e l . Perhaps speech acts are most interesting here in that they take an active role i n carrying out the act of speaking just as would a motor action when carrying out some sort of physical act. Because of the "multiple mode" aspect of JLISP, speech acts can be asked to either EXPECT (understand) or to EXECUTE (produce) a speech act. In EXPECT mode a speech act must read an utterance and interpret i t i n any way i t sees f i t (perhaps by c a l l i n g in the language l e v e l ) ; in EXECUTE mode a speech act must generate a surface utterance in any way i t sees f i t (perhaps with the help of the language level) and then print i t . The language l e v e l i s the least well developed of the model, but does have a couple of inte r e s t i n g features. I t ' s Chapter VII 246 s y n t a c t i c component, insofar as i t can be separated out, i s more or less a top-down parser that groups words for i t s semantic component, which i s more a less a case parser. The combination of the two approaches i s n ' t too common (but see Taylor and fiosenberg (1975) for one example) and seems to be quite successful. The general a b i l i t y of JLISP objects and message passing to accomodate successfully to this l e v e l i s g r a t i f y i n g . Of p a r t i c u l a r effectiveness i s the conceptualizing of a noun group or verb group as an execution instance with an EX-ENVIRON pointer to the context i n which the words were uttered, and an EX-INSTANCE-OF pointer to the l i n g u i s t i c object {NOUNG or VERBG) of which they are an i n s t a n t i a t i o n , and a ROLE-INSTANCE-OF pointer to the concept which they represent. This allows information about the context of the word group, the word group i t s e l f , and the concept represented by the word group a l l to be accessed. The conversant models i n the model are not sophisticated at the present time, the main idea having been to find out how to connect conversant models into a l l the other processing, not so much to build an i n t r i c a t e web of conversant knowledge. Scripts and speech acts have d i r e c t l y available to them conversant models for a l l conversants, whereas language l e v e l goals do not. Of course, for any subgoal of a s c r i p t or speech act, the conversant models are i n d i r e c t l y available from the s c r i p t or speech act. Conversant models have at least two i n t e r e s t i n g aspects: f i r s t , the use of ROLE-INSTANCE-OF patterns (often with context dependent macros embedded in them) allow conversants to Chapter VII 247 be viewed i n p a r t i c u l a r roles (e.g. s e l l e r , buyer) as well as in t h e i r standard "person" r o l e ; second, there i s a conversant model for the model i t s e l f . Both these aspects are important for the completeness and symmetry of the processing. 7.3 Future Directions There i s , of course, much s t i l l to be done towards the grand design of a model of conversation. The f i r s t step i s to implement \LISP and then see how well i t works by running through the currently pseudo-implemented ticket buying and drink buying conversations. This would doubtless r a i s e several important issues, prime among them e f f i c i e n c y of execution. Things l i k e f a i l u r e to match processing and IF-ADDED and IF-REMOVED methods may be overly expensive computationally unless controlled with draconic prudence. Probably also a r i s i n g here would be the problem of explaining the f a i l u r e of subgoals i n a much more serious way, a step which would become even more important i n less directed conversations. And, in f a c t , a f t e r running through the t i c k e t buying and drink buying conversations, the next step would indeed be to try out l e s s task-oriented dialogues such as the conversation with a f r i e n d . Handling such conversations would bring up many of the non-goal-directed issues raised i n the l a s t chapter. I t seems clear that a much larger role for bottom-up processing and, i f some version of i t can be made combinatorially sound, associative a c t i v a t i o n i s c r u c i a l i f the model i s to be extended Chapter VII 2 4 8 to handle more f l u i d conversations. The need f o r JPEXPfi comparison would also guickly arise as well. C r u c i a l in conversations such as these would be a working episodic c a p a b i l i t y so that references to previous utterances wouldn't leave the model perplexed. To t h i s end, an exploration of when and how to search episodic memory would have to be car r i e d out. But, most important, would be the need to figure out what old episodes to keep and which ones to free f o r garbage c o l l e c t i o n . As Schank and Abelson (1975) have pointed out, and as the proposals presented here i l l u s t r a t e well, a theory of for g e t t i n g promises to be a c e n t r a l concern of much future work i n a r t i f i c i a l i n t e l l i g e n c e . Because the current model of conversation and i t s (LISP base have been designed with generality and e x t e n s i b i l i t y in mind, t h e i r further development along these l i n e s w i l l not l i k e l y be too traumatic. The research undertaken so f a r should provide a s o l i d foundation for the endeavours to come. Chapter VII 249 BIBLIOGRAPHY Abelson (1973). R. P. Abelson, "The Structure of B e l i e f Systems", i n R. C. Schank, K. M. Colby (eds.). Computer Models of Thought and Language, Freeman, San Francisco, 1973. Austin (1962). J. L. Austin, How to do Things with Words, Oxford University Press, Oxford, England, 1962. Becker (1969). J. D. Becker, "The Modelling of Simple Analogic and Deductive Processes i n a Semantic Memory System", Proc. IJCAI1, Washington, D.C., May 1969, pp. 655-688. Bloomfield (1933). L., Bloomfield, Language, Holt, Rinehart, New York, 1933. Bobrow and C o l l i n s (1975). D. G. Bobrow and A. C o l l i n s (eds.). Representation and Understanding, Academic Press, New York, 1975. Bobrow and Wegbreit (1973). D. G. Bobrow, B. Wegbreit, "A Model and Stack Implementation of Multiple Environments", CACM, J6, 10, October 1973, pp. 591-602. Bobrow and Winograd (1976). D. G. Bobrow and T. Winograd, An Overview of KRL, a Knowledge Representation- Language, Tech. Rpt. CSL-76-4, Xerox Palo Alto Research Center, Palo Alto, C a l i f . , 1976. Bruce (1975)., B. Bruce, Belief Systems and• Language Understanding, BBN Rept. #2973, Bolt, Beranek, and Newman, Inc., Cambridge, Mass., 1975. Chafe (1970). W. Chafe, Meaning and the Structure of- Language, U. of Chicago Press, Chicago, I l l i n o i s , 1970. Chafe (1975). W. Chafe, "Some Thoughts on Schemata", Proc. TINLAP, Cambridge, Mass., June 1975, pp. 99-101. Charniak (1972). E. Charniak, Toward a Model of Children's Story Comprehension, MAC-TR-51, MIT AI Lab., Cambridge, Mass., December 1972. Charniak (1975). E. Charniak, "Organization and Inference in a Frame-like System of Common Knowledge", Proc. TINLAP, Cambridge, Mass., June 1975, pp. 46-55. Chomsky (1957). N. Chomsky, Syntactic Structures. Mouton, The Hague, 1957. Chomsky (1971). N. Chomsky, "Deep Structure, Surface Structure, Bibliography 250 and Semantic Interpretation", in Steinberg and Jakobovits (1971) . P. Cohen (1977). P. Cohen, A Helpful Computer Conversant, Ph.D. Thesis, Dept. of Computer Science, U. of Toronto, Toronto, Ontario, 1977 (in preparation). a . Cohen (1976). R. Cohen, Computer Analysis of Temporal Reference, M.Sc. Thesis, Dept. of Computer Science, 0. of Toronto, Toronto, Ontario, Dec. 1976. C o l l i n s and Grignetti (1975). A. C o l l i n s , fl. C. G r i g n e t t i , I n t e l l i g e n t CAI, 8BN Report 3181, Bolt, Beranek, and Newman, Inc., Cambridge, Mass., October, 1975. Deutsch (1974). B. Deutsch, "The Structure of Task Oriented Dialogues", IEEE Symposium on Speech Recognition, Carnegie-Mellon University, Pittsburgh, Penn., A p r i l 1974. Fahlman (1975). S. Fahlman, A System f o r Representing and Using Real Horid Knowledge, MIT AI Memo 331, Cambridge, Mass., May 1975. Feigenbaum and Feldman (1963). E.A. Feigenbaum, J. Feldman (eds.). Computers and Thought. McGraw-Hill, New York, 1963. Fillmore (1968). C. Fillmore, "The Case f o r Case", i n E. Bach, R. Harms (eds.), Universals in L i n g u i s t i c Theory, Holt, Rinehart, and Winston, New York, 1968, pp. 1-88. Fillmore (1975). C. Fillmore, "An Alternative to Checklist Theories of Meaning", Proc. F i r s t Annual Meeting of the Berkeley L i n g u i s t i c s Society, Berkeley, C a l i f . , Feb. 1975, pp. 123-131. Funt (1976). B. V. . Fun t, WHISPER: A C o mput er Implementation Using. Analogues i n Reasoning, Ph.D. Thesis, Dept. of Computer Science, UBC, Vancouver, B.C., March 1976. Garfinkel (1972). H. Garfin k e l , "Studies of the Routine Grounds of Everyday A c t i v i t i e s " , i n D. Sudnow (ed.), Studies i n Social Interaction, The Free Press, New York, 1972, pp. 1-30. Goffman (1974). E. Goffman, Frame Analysis, Harper Colophon, New York, 1974. Green et a l (1963). B, F. Green, A. C. Wolf, C. Chomsky, K. Laughery, "BASEBALL; An Automatic Question Answerer", in Feigenbaum and Feldman (1963) , pp. 207-216. Grice (1957). H. P. Grice, "Meaning", Philosophical Review, Bibliography 251 July 1957, pp. 377-388., Grice (1968). H. P. Grice, Logic and Conversation, Wm..James Lecture, Unpublished Mimeo, Berkeley, C a l i f o r n i a , 1968. Havens (1977). W.. S. Havens, A Co mp. u t at io na 1 Model for Frame Systems, Ph.D. Thesis, Dept. of Computer Science, UBC, Vancouver, B.C., 1977 (in preparation). Hendrix (1975). G. Hendrix, "Expanding the U t i l i t y of Semantic Networks through P a r t i t i o n i n g " , Proc. IJCAI4, T b i l i s i , USSB, Sept. 1975, pp. 115-121. Hewitt (1972). C. Hewitt, Description and Theoretical Analysis JUsing Schemata) of PLANNER: A Language for Proving Theorems and Manipulating Models in a Robot, MIT AI Memo 251, Cambridge, Mass., April 1972. Hewitt (1975). C. Hewitt, "Stereotypes as an ACTOR Approach Towards Solving the Problem of Procedural Attachment i n FRAME Theories", Proc. TINLAP, Cambridge, Mass., June 1975, pp. 108-117. Hewitt et a l (1973). C. Hewitt, P. Bishop, R. Steiger, "A Universal Modular Actor Formalism for A r t i f i c i a l I ntelligence", Proc. IJCAI3, Stanford, C a l i f . , Aug. 1973, pp. 235-245. Hewitt and Greif (1974). C. Hewitt, I. Greif, "Actor Semantics of PLANNER-73", MIT AI Lab. Working Paper 81, Cambridge, Mass., November, 1974. Horrigan (1977) . M.,K. Horrigan, Modelling Simple Dialogs, M.Sc. Thesis, Dept. of Computer Science, U. of Toronto, Toronto, Ontario, Jan. 1977. Murtubise (1976) . S. J . Hurtubise, "A Model and Stack Implementation of a Conversation Between Some Man and a Smart-Aleck Computer", Third CSCSI / SCEIO Newsletter, August 1976, pp. 46-50. Gi. Lakoff (1971)., G. Lakoff, "On Generative Semantics", i n Steinberg and Jakobovits (1971). Lakoff and Ross (1972). G. Lakoff, J . R. Ross, "A Note on Anaphoric Islands and Causatives", Ling. I n s * , J # 1, Summer 1972, pp. 121-127. fi. Lakoff (1973). R. Lakoff, "The Logic of Politeness; or Minding your P's and Q's", Proc. CLS9, 1973, pp. 292-305. Leech (1974). G. Leech, Semantics, Penguin Books, England, 1974. Bibliography 252 Levesgue (1977), H. Levesgue, A Procedural Approach to Semantic Networks, M.Sc. Thesis, Dept. of Computer Science, 0. of Toronto, Toronto, Ontario, Jan. 1977. Levin and Moore {1977). J. A. Levin, J . Moore, Dialogue Games: Meta-Cpmmunication Structures for Natural Language Interaction, ISI/RR-77-53, Information Sciences I n s t i t u t e , U. of Southern C a l i f o r n i a , Marina del Rey, C a l i f . , Jan. ,1977. Linde (1974). C. Linde, "Information Structures i n Discourse, NWAVE I I I , Georgetown University, Oct. 1974. Lindsay (1963). R. K. Lindsay, " I n f e r e n t i a l Memory as the Basis of Machines which Understand Natural Language", i n Feigenbaum and Feldman (1963), pp. 217-233. Martin (1975). W. A. Martin, Conceptual Grammar-, Automatic Programming Group Internal Memo 20, Project MAC, MIT, Cambridge, Mass., 1975. McCalla (1973). G. I. McCalla, A Model for Man - Machine Dialogue, Ph.D. Thesis Progress Report, Dept. of Computer Science, UBC, Vancouver, B.C., Nov. 1973. McDermott and Sussman (1974). D. V. McDermott, G. J. Sussman, The CONNIVER Reference Manual, MIT AI Memo 259a, Cambridge, Mass., Jan. 197 4. Minsky (1970). M. Minsky, "Form and Content i n Computer Science", JACM, 12, 2, A p r i l 1970, PP. 197-215. Minsky (1974). M. Minsky, A Framework for Representing Knowledge, MIT AI Memo 306, Cambridge, Mass., June 1974. Moore and Newell (1973). J. Moore, A. Newell, How Can MERLIN Understand?, Dept. of Computer Science, Carnegie-Mellon University, Pittsburgh, Penn., Nov. 1973. Newell (1973). A. Newell, "Production Systems: Models of Control Structures", i n S. G. Chase (ed.). Visual Information Processing, Academic Press, New York, 1973, PP. 403-426. Q u i l l i a n (1969). M. R. Q u i l l i a n , "The Teachable Language Comprehender: A Simulation Program and Theory of Language", CACM, 12, 8, August 1969, pp. . 459-476. Rieger (1974). C. J. Rieger, Conceptual Memory: A Theory and Computer Program for Processing the Meaning-Content of Natural Language Utterances, Ph.D.,Thesis, Stanford University, Stanford, C a l i f . , 1974. Roussopoulos (1976). N. fioussapolous, A Semantic Network Model B i b l i o g r a p h y 253 of Data Bases, Ph.D. Thesis, Dept. of Computer Science, U. of Toronto, Toronto, Ontario, November 1976. Rowat (1974). P. F. Rowat, Pesiqning a Robot- Controller: A Report on «x Thesis Research, Ph.D. Thesis Progress Report, Dept. of Computer Science, UBC, Vancouver, B.C., March 1974. Sandewall (1975). E. Sandewall, "Ideas About the Management of LISP Data Bases", Proc. IJGAI4, T b i l i s i , USSR, Sept. 1975, pp. 585-592. Schank (1972). R.C. Schank, "Conceptual Dependency: A Theory of Natural Language Understanding", J. Cog. Psych., 3, 4, October 1972, pp. 552-631. Schank (1974). R.C. Schank, Is There a Semantic Memory?, Report #3, I s t i t u t o per g i i Studi Semantici e C o g n i t i v i , Castagnola, Switzerland, 1974. Schank (1975). R. C. Schank, "The Primitive ACTs of Conceptual Dependency", Proc. TINLAP, Cambridge, Mass., June 1975, pp. 38-41. Schank and Abelson (1975). R.C. Schank, R. P. Abelson, "Scripts, Plans, and Knowledge", Proc. IJCAI4, T b i l i s i , USSR, Sept. 1975, pp. 151-157. Schegloff (1971). E. A. Schegloff, "Seguencing i n Conversational Openings", i n J. A. Fishman (ed.), Advances i n the Sociology of Language, Vol. I I , Mouton, The Hague, 1971, pp. 91-125. Schwarcz et a l (1970). R. M. Schwarcz, J . F. Burger, R. F. Simmons, "A Deductive Question Answerer f o r Natural Language Inference", CACM, 13, 3, March 1970, pp. 167-183. Searle (1969). J. R. Searle, Speech Acts, An Essay in the Philosophy of Language, Cambridge University Press, Cambridge, England, 1969. S h o r t l i f f e (1976). E. H. S h o r t l i f f e . Computer-Based Medical Consultations: MYCIN, American-Elsevier, New York, 1976. Steinberg and Jakobovits (1971). D. D. Steinberg, L. A. Jakobovits (eds.), Semantics, an I n-t e r d i s c i pi in ar y Reader, U. of I l l i n o i s Press, Urbana, I l l i n o i s , 1971. Sussman {1973). G. J. Sussman, A - Computational Model of s k i l l Acguisition, MIT AI TR-297, Cambridge, Mass., August 1973. Sussman and Hinograd (1970). G. J. Sussman, T. Hinograd, Bibliography 254 Micro-Planner Reference Manual, MIT AI Memo 203, Cambridge, Mass., July 1970. Taylor and Rosenberg (1975). B. H. Taylor, R. S. Rosenberg, "A Case Driven Parser for Natural Language", AJCL, Microfiche 31, 1975. Tesler et a l (1969). L. Tesler, H. Enea, K. M. Colby, "A Directed Graph Representation for Computer Simulation of Beli e f Systems", Mathematical Biosciences, 2, 1968, pp. 19-40. Milks (1973). Y. Wilks, "Understanding Without Proofs", Proc. IJCAI3, Stanford, C a l i f . , August 1973, pp. 270-277. Winograd (1972). T. Winograd, Understanding Natural Ljinquage, Academic Press, New York, 1972. Winograd (1974). T. Winograd, "Breaking the Complexity Barrier Again", SIGPLAN Notices. December 19 74. Winograd (1975). T. Winograd, "Frames and the Procedural-Declarative Controversy", i n Bobrow and C o l l i n s (1975), pp. 185-210. Winograd (1976). T. Winograd, "Towards a Procedural Understanding of Semantics", Revue In t er nat 1 on-a-1 e de Philosphie. 1976. Winograd (1977). T. Winograd, A Framework for Understanding Discourse, to appear as a SAIL Memo, AI Lab., Stanford University, Stanford, C a l i f . , 1977. Winston (1970). P. H. Winston, Learning Structural Descriptions from Examples, MAC TR-76, MIT, Cambridge, Mass., 1970. Wong (1975). H. K. T. Wong, Generating, English Sentences from Semantic Structures. M.Sc. Thesis, Dept. of Computer Science, U. of Toronto, Toronto, Ontario, 1975. Woods (1975). W. A. Woods, "What»s i n a Link: Foundations for Semantic Networks", in Bobrow and C o l l i n s (1975). Woods et a l (1972). W. A. Woods, R. M. Kaplan, B. Nash-Webber, The Lunar Sciences Natural Language Information System: Fin a l Report, BBN Report Number 2388, Bolt, Beranek, and Newman, Inc., Cambridge, Mass., June 1972. Abbreviations: AJCL: American Journal of Computational L i n g u i s t i c s CACM: Communications of the ACM CLS: Chicago L i n g u i s t i c s Society Bibliography 255 IJCAI: International Joint Conference on AI JACM: Journal of the ACM J. Cog. Psych.: Journal of Cognitive Psychology SIGPLAN: ACM Special Interest Group on Programming Languages TINLAP: Conference on Theoretical Issues i n Natural Language Processing Bibliography 2 5 6 APPENDIX I Some System Objects-In t h i s Appendix several system objects are presented i n terms of t h e i r input / output behaviour and also, for cer t a i n important objects, i n terms of their l o g i c flow. The Appendix forms a handy reference, especially when reading the detailed examples of Chapter V. The following notational conventions have been used throughout the Appendix: Ai i s an atom (i.e. a single name); Si i s an s-expression; L i i s a l i s t ; P i i s a pattern; Ni i s a number; NIL i s the n u l l l i s t () which stands for " f a l s e " or f a i l u r e to match depending on the context; |U i s a special NIL-like atom which stands f o r " u n - i n i t i a l i z e d " and i s used to assign a value to cer t a i n pattern matching macros before they are bound in the match; T i s the "true" atom; EXPR indicates an object of type EXPR and has three possible s u b - c l a s s i f i c a t i o n s : LAMBDA, NLAMBDA, or FLAMBDA; JEXPR indicates an object of type jEXPR and has three possible s u b - c l a s s i f i c a t i o n s : |LAMBDA, iNLAMBDA, or JFLAMBDA. In addition to these standard assumptions, there are many sp e c i a l forms whose names are given (hopefully meaningful) mnemonics. Appendix I 257 h-1-1 Basic Interpreter Objects i 1 I(1EVAL message-form) I j EXPB| J (LAMBDA) J i j |EVAL i s the JLISP interpreter. Its basic logic follows: C a l l i n (JOPDATE-TIMEB) before proceeding. Then, i f message-form i s an atom, i t s value on the current execution instance's stack i s returned; i f none i s found, an error i s generated. I f the CAB of message-form i s an atom, then - i f i t i s QUOTE, message-form i s returned; - i f i t i s the name of a JPEXPB, then (| SCHEDULE message-form) and resume execution of scheduler; - i f i t i s the name of a |EXPB, then construct the appropriate (LAMBDA expression, returning r e s u l t of (EVALing t h i s (LAMBDA expression with CDS of message-form as arguments; - s i m i l a r l y , i f i t i s the name of an EXPR, construct the appropriate LAMBDA expression returning the r e s u l t of ]EVALing t h i s LAMBDA expression with the CDR of message-form as arguments; - i f i t i s the name of a SUBB, APPLY CAB of message-form to |EVLIS of the CDS of message-form and return the re s u l t i n g value; - i f i t i s anything else, there i s an error. Appendix I 258 I f the CAB of message-form i s a l i s t and the CAAB i s -1 LAMBDA, then bind the | LAMBDA parameters to jEVLIS of the arguments (nsing the current |PEXPB stack); |EVAL the body of the JLAMBDA; return the r e s u l t ; -JNLAMBDA, then bind the JNLAMBDA parameters to the arguments (not |EVALed) (using the current |PEXPB stack); |EVAL the body of the |NLAMBDA; return the r e s u l t ; -JFLAMBDA, then bind the J FLAMBDA parameter to a l i s t of the arguments (not J EVALed) ; J EVAL the body of the |FLAMBDA; return the re s u l t ; -LAMBDA, then APPLY the LAMBDA expression to JEVLIS of the arguments and return the r e s u l t ; -NLAM BDA or FLAMBDA, then APPLY the NLAMBDA or FLAMBDA expression to the arguments (neither JEVALed nor EVALed) and return the r e s u l t . If message-form i s anything else, then there i s an error. j (J SCHEDULE message-form) I i EXPBJ I (LAMBDA) J If message-form i s not a l i s t or i t s CAR i s not the name of a J PEXPB, then there i s an error. Otherwise, l e t CAB of message-form be known as the "receiving-object". J SCHEDULE f i r s t of a l l creates a new execution instance, "new-object", of receiving-object in which w i l l be asserted (EX-INSTANCE-OF new-object receiving-object) Appendix I 259 (EX-ENVIRON new-object c u r r e n t - e x - i n s t a n c e ) (STACK new-object () ) Then, message-form i s checked to see i f t h e r e are any s p e c i a l messages: {JPRIO= p r i o r i t y ) : i f found, s t r i p i t from message-form and |ASSERT (JPRIO= new-object p r i o r i t y ) i n new-object; i f not found, (ASSERT (|PRIO= new-object 5); (|TIME= t i m e - l i m i t ) : i f found, s t r i p i t from message-form and (ASSERT (1TIME-LIM= new-object t i m e - l i m i t ) and (|TIME-NOW= new-object t i m e - l i m i t ) i n new-object; (JC0ND= p a t t e r n ) : i f found, s t r i p i t from message-form and (ASSERT i n new-object (|COND= new-object p a t t e r n ) ; (JEND= e n d - l i m i t ) : i f found, s t r i p i t from message-form and (ASSERT i n new-object (|END= new-object e n d - l i m i t ) . A f t e r completing t h e s e a r c h f o r s p e c i a l messages, the (reduced) message-form i s embedded i n a c a l l t o JPEXPR-MH, the standard |PEXPR message handler. Thus, (JPEXPR-MH message-form) i s pushed onto the stack of new-object under the i n d i c a t o r JEV i n d i c a t i n g t h at i t i s the top JEVAL block on the st a c k of new-object. A l i s t (new-object p r i o r i t y ) i s then merged i n t o the execute gueue according t o i t s p r i o r i t y . F i n a l l y , J SCHEDULE r e t u r n s new-object. Appendix I 260 j ( | UP DATE-TIB EE) | I EXPEJ 1 (LAMBDA) | Every 100 times JEVAL i s c a l l e d , JUPDATE-TIMEB reduces a l l JTIME-N0w= patterns in the current execution environment by 1., I f any JTIME-NOw= patterns are at 0, then c a l l (|INTEBBUPT-PBOCESSING 'J TIME= 0 ex-instance-int) where "ex-instance-int" i s the execution instance i n which the time v i o l a t i o n occurred. r , J (JINTERBUPT-PEOCESSING type-int v a l - i n t ex-instance-int) J J EXPEJ 1 (LAMBDA) J This object i s c a l l e d i n when an interrupt of type-int (either JTIME= or JC0ND=) has been detected i n ex-instance-int. v a l - i n t i s either 0 i n the case of a JTIME= interrupt or, i n the case of a |COND= inter r u p t , the pattern which matched the |COND= interrupt pattern. |INTEBSUPT-PBOCESSING f i r s t looks into the execution environment of the current execution instance for the nearest semaphore ( i f there i s none, assume the semaphore i s "OFF"). If i t i s "ON", return NIL; else, reduce JEND-LIM= pattern i n ex-instance-int by 1. I f the |END-LIM= pattern i s 0, then no interrupts are l e f t , so set up a return condition i n the EX-ENVIBON execution instance Appendix I 261 of e x - i n s t a n c e - i n t t o be (|RETURN-COND e x - e n v i r o n - i n s t | END= { e x - i n s t a n c e - i n t e x - i n s t a n c e - c u r r e n t ) v a l - i n t ) I f i t i s not 0, then s e t up a r e t u r n c o n d i t i o n i n e x - e n v i r o n - i n s t to be (|RETURN—COND e x - e n v i r o n - i n s t t y p e - i n t ( e x - i n s t a n c e - i n t e x - i n s t a n c e - c u r r e n t ) v a l - i n t ) I f t y p e - i n t i s j TIME— then r e s e t JTIME-NOB= p a t t e r n to be the same as |TIME-LIM=. Merge e x - e n v i r o n - i n s t i n t o execute gueue with i t s s t o r e d p r i o r i t y and resume ex e c u t i o n of the sch e d u l e r . J {J SCHEDULER) \ 1 EXPR | J (LAMBDA) | T h i s o b j e c t removes f i r s t o b j e c t / p r i o r i t y p a i r from the execute gueue, s e t s the c u r r e n t execution i n s t a n c e t o be t h i s o b j e c t , takes the top J EVAL block from the stack of the o b j e c t , and JEVALs the form t h e r e . J {)PEXPR-MH message-form) | 1 EXPR | i (LAMBDA) | |PEXPR-MH i s the usual message handler f o r JPEXPRs. The r e c e i v i n g o b j e c t i s the f i r s t element of message-form; the r e s t of the elements of message-form are p a t t e r n s to be matched i n the body of r e c e i v i n g - o b j e c t . For each such Appendix I 262 mess-pattern, |PEXPR-MH c a l l s (I MATCH mess-pattern ex-environ-inst receiving-pattern current-inst) for a l l receiving-patterns in the current execution instance u n t i l a match i s found. If no such match i s discovered, f a i l u r e to match processing ensues; i . e . a message {FAILURE—TO-MATCH mess-head mess-pattern current-inst ?matching-pattern) i s sent to mess-head, the f i r s t element of mess-pattern). If this s t i l l f a i l s to turn up a matching pattern (i . e . matching-pattern i s NIL), then NIL i s concatenated to an answer l i s t . I f a matching pattern i s found, the resu l t of JMATCH i s concatenated to answer l i s t and |ASSERTed i n the execution instance. When a l l message patterns have been handled, a return condition i s set i n ex-environ-inst {j RETURN-COND ex-environ-inst NORMAL (current-inst) answer-list) and i t s stack i s modified so that answer-list w i l l also be the value returned from the message sent to receiving-object. ex-environ-inst i s then merged into the execute gueue with i t s stored p r i o r i t y and the scheduler i s resumed. Appendix I 263 AJ.. 2 Redefined LISP SUBRs Many LISP functions can be used d i r e c t l y as objects i n JLISP. This i s not the case for LISP FSUBBs or NSUBRs which must be redefined so that t h e i r arguments can be |EVALed rahter than EVALed. In addition certain SUBRs which depend on EVAL for their meaning (e.g. EVAL, APPLY, APPLY 1, ...) or which o r d i n a r i l y use the LISP stack (e.g. SET, SETQ, .,.) or which use the property l i s t features of LISP (e.g. PUT, GET, ..,) must also be redefined. The rest of the SUBRs (e.g. CAR, CDR, CONS, EQ, ATOM, .,.) can be used as i s , since the JLISP interpreter automatically JEVALs their arguments. The following are rewritten versions of the corresponding LISP functions ( a l l are EXPRs): (JEVAL S1): see section A 1 - 1; (JEVLIS S1 ... Sn): l i k e EVLIS, but JEVALs i t s arguments; (JAPPLY FN S1 ... Sn) ; the same as APPLY except JEVAL used; (|APPLY 1 FN S1 ... Sn): the same as APPLY1 except JEVAL used; (JSET A1 S1 ... An Sn): uses current execution instance's stack; (J SETQ A1 S1 ... An Sn) : uses current execution instance's stack; (JUNEVAL A1 <S1>): uses current execution instance's stack; Appendix I 264 (I MAP FN L1): uses | EVAL rather than EVAL; s i m i l a r l y the other HAPping functions; (JCOND (S11 ... S1n) ... (Sk1 Skm)): uses JEVAL rather than EVAL; {|AND S1 ...Sn): uses JEVAL rather than EVAL; (I OB S1 ...Sn): uses J EVAL rather than EVAL; (J PROG L1 S1 ... Sn): works l i k e PROG only binds on the current execution instance and JEVALs the S i ; (|GO A1): works l i k e GO except goes to la b e l inside of JPBOG or |EVENT-SEQUENCE and argument i s JEVALed; (|RETURN A1 <A2>): works l i k e RETURN but uses current execution instance stack. I f A2 i s the keyword JHANDLER, then control w i l l resume i n the matcher of the message handler of the current execution instance with the value of the current pattern element being A1. Thus, for example, i f there were a pattern (X Y ! (JPROG {) (| RETURN ' DOG | H AN DLER) } Z) in the JPEXPR F00, and the message (X Y ?VAL Z) were sent to FOO, then at the point the JRETURN was executed, control would resume i n the message handler of FOO's execution instance with the value of the t h i r d element being DOG and the match continuing to the fourth element. To force f a i l u r e of the match, JRETURN NIL to the JHANDLER. Appendix I 265 JL1. 3 Objects Which Create Objects r ^ j (j DEFUN A 1 < A 2 > L 1 S 1 ... Sn) j i N EXPR J i (FLAMBDA) J c , This object works l i k e LISP ' S DEFUN except that in addition to EXPRs, |EXPRs can be defined by using the indicator |EXPR, JNEXPR, or JFEXPR for A 2 (default (EXPR). Note that A 1 i s globally defined as a (EXPR, JNEXPR, or whatever, since the LISP atom i s modified. I t seems unnecessary to me to have a procedure defining c a p a b i l i t y that defines procedures only within a given JPEXPR, since i t i s usually the case that a procedure name i s something that remains fixed throughout the system (especially true here since EXPRs and JEXPRs are defined to be objects known system wide). The sit u a t i o n where l o c a l i t y i s important can be adeguately handled by either renaming the procedure or by using "!" or "$" macros i n patterns of a JPEXPR. r ^ J (J PDEF A 1 P 1 ... Pn) j J EXPR J J (FLAMBDA) J »- ; J This object creates A1 as a pattern expression. Each pattern P i i s either of the form "name-i : ( . . , ) " Or simply "( ... ) M . These patterns can contain sub-patterns of either type as well, so that Appendix I 266 (DOG C H A S E DESC : {CAR COLOUR RED)) would work p e r f e c t l y well (without, I should add, the DESC sub-pattern being added as a t o p - l e v e l p a t t e r n , but being l a b e l l e d n o n e t h e l e s s ) . Using JASSERTLIS, each pat t e r n P i i s a s s e r t e d i n A1 (with a p p r o p r i a t e IF-ADDED checks - see below), r e s u l t i n g i n a s t r i n g of p a t t e r n s being attached to the LISP property l i s t o f A1 under the a t t r i b u t e iPEXPR. i 1 j (|CREATE-NEW A1) J J EXPR| i (LAMBDA) | i t T h i s o b j e c t w i l l c r e a t e a new i n s t a n c e of A1 with a p p r o p r i a t e (INSTANCE-OF new-inst A1) p a t t e r n being a s s e r t e d i n the new i n s t a n c e along with a (CREATION-ENVIRON new-inst e x - i n s t a n c e - c u r r e n t ) p a t t e r n . The name of the new i n s t a n c e i s returned. A1.4 o b j e c t s f o r Communicating with Objects i 1 j (|DY NAMIC A1 mess-1 ... mess-n) | 1 | EXPR | | {|LAMBDA)| i . . i T h i s w i l l send a s e t o f messages to A1 and r e t u r n the a p p r o p r i a t e answer l i s t . I t i s used when the r e c e i v i n g o b j e c t or messages need to be j EVALed. Appendix I 267 J (| RETORN-COND) | i EXpa i i (LAMBDA) J This object w i l l return as value the return condition of the current execution instance. The p o s s i b i l i t i e s : - ( j RETURN-COND ex-inst-current NORMAL (ex-inst-receiving) value) -(J RETURN-COND ex-inst-current AU-REVOIR {ex-inst-receiving restart-name) value) - (| RETORN-COND ex-inst-current (TIME= (ex-inst-interrupt ex-inst-executing) value) -{jBETOBN-COND ex-inst-current JC0ND= (ex-inst-interrupt ex-inst-executing) value) —(IBETOBN-COND ex-inst-current j END= (ex-inst-interrupt ex-inst-executing) value) The following can be used to access pa r t i c u l a r parts of the return condition: {jRETORN-TYPE): w i l l return t h i r d element of return condition; {J RETURN-CODES); w i l l return fourth element of return condition; (| RETURN-VALUE) : w i l l return f i f t h element of return condition; Appendix I 26 8 AJ. - 5 Objects Involved i n Matching r j | (I HATCH source-pat source-obj target-pat target-obj) j I | E X P R | 1 (| FLAMBDA) j t j Of the •"arguments" to t h i s object, source-pat and target-pat are not J EVALed; source-obj and target-obj are. source-pat i s matched against target-pat, with macros of source-pat elements being expanded i n the context of source-obj while those of target-pat elements are expanded in the context of target-obj. Returned i s either MIL ( i f there i s no match) or the matching pattern ( i f there i s a match). The basic l o g i c flow of |MATCH follows: If source-pat i s not the same length as target-pat, the match f a i l s so return NIL. Otherwise, set answer-pattern to NIL and compare each pair of source / target elements u n t i l a l l are handled (in which case return answer-pattern) or u n t i l comparison f a i l s f or some pair (in which case return NIL). The comparison for two elements: 1. i f a macro precedes both elements, do macro-conflict processing (see macro-conflict table i n Appendix II) and proceed; else i f a macro precedes one element, expand i t and replace the element by the r e s u l t returned from the macro expansion (macros use the appropriate source-obj or target-obj for binding and lEVALuation i f necessary); Appendix I 269 2. i f either element i s NIL, the element comparison f a i l s ; 3. i f both elements are atoms, then element comparison succeeds i f they are the same atom i n which case append the atom to answer-pattern and get the next source / target pair; else element comparison f a i l s ; 4. i f both elements are l i s t s , then (|MATCH source-el source-obj tar g e t - e l target-obj) and i f NIL i s returned then element comparison f a i l s ; otherwise append the value returned to answer-pattern and get the next source / target pair; 5. i n any other s i t u a t i o n element comparison f a i l s . i (|PATTERN pat <|PEXPR>) J 1 |EXPRi i (I FLAMBDA) | pat i s not |EVALed; JPEXPR, i f given, i s . |PATTERN w i l l match pat against patterns i n j PEXPR (default the current execution instance) with the f i r s t matching pattern returned as value (using the standard J PEXPR-MH order of matching). Context for a l l macros i s the current execution instance; f a i l u r e to match processing takes place. r 1 j (|PATTERN-ALL pat <jPEXPR>) j J |EXPRJ i ( | FLAMBDA) J • j Appendix I 270 pat i s not J EVALed; |PEXPR, i f given, i s . This object w i l l match pat against a l l patterns in JPEXPR (default the current execution instance) with a l i s t of matching patterns returned as value. Any assignments i n pat are made to the l a s t value; the current execution instance forms the context for macro-expansion; f a i l u r e to match processing does not take place. I T 1 (j POINTER A1 <|PEXPR>) | | |EXPRJ J {|FLAMBDA) | i 1 A1 i s not |EVALed; |PEXPR i s , i f given; |POINTER w i l l f i n d the f i r s t pattern i n JPEXPR (default the current execution instance) matching (A1 )PEXPR #X) and w i l l return the X i f successful (NIL otherwise). , The current execution instance i s used for macro expansion; f a i l u r e to match processing takes place. J (| POINTER-ALL Al <jPEXPR>) J i JEXPR| I (j FLAMBDA) | i j A1 i s not JEVALed; JPEXPR i s , i f given; ]POINTER-ALL w i l l find a l l patterns in JPEXPR (default the current execution instance) matching (A1 JPEXPR #X) and w i l l return a l i s t of a l l the X*s so found (or NIL i f none are found). Macros are expanded i n the context of the current execution instance; f a i l u r e to match processing does not take place. appendix I 271 J (| UN ASSIGNED A1) J 1 EXPR| 1 (LAMBDA) | This simple object w i l l return T i f Al has the value |U (i.e. i t has been unassigned as part of a macro-conflict) ; NIL otherwise. Al.. 6_ Objects Which Manipulate Patterns r j | (| ASSERT pat < J PEXPR <int-flag») j 1 |EXPR J i (| FLAMBDA) J *. j |PEXPR (default the current execution instance) and i n t - f l a g (default NIL) are | EVALed; pat i s not, but any "/" # "i"t '* or macros are expanded (note that and "/" designate pattern labels in J PEXPR, not i n the current execution instance, unless they are the same). pat i t s e l f can be an ordinary pattern "( ... )" or i t can be a lab e l l e d pattern "name-i : { ... )". |ASSERT w i l l assert pat i n JPEXPR; i.e . w i l l add i t on to the beginning of the l i s t of patterns already attached to JPEXPR under the marker JPEXPR on i t s property l i s t . The order i s important since JPEXPR-MH just scans down thi s l i s t when looking for a match for a message. Adding more recent patterns to the beginning of the l i s t e f f e c t i v e l y Appendix I 272 gives a "most recent to least recent" search order. JCOND= interrupt checking w i l l be carr i e d out i f i n t - f l a g i s T. After adding the pattern, JASSERT executes any IF-ADDED procedure that may be associated with the head of pat. Such patterns look l i k e (IF-ADDED head ?pattern ! (j PROG () )) And allow such things as inverses and other "automatic" side-effects to be accomplished for a pa r t i c u l a r type of pattern. When i t i s finished, JASSERT returns pat (with appropriate macro expansions substituted f o r macro elements). ! , |(|ASSERTLIS l i s t - o f - p a t s ) j i JEXPR J j (j FLAMBDA) | L j This object w i l l assert each pattern i n the l i s t of pats using iASSERT. Each such pattern looks l i k e (pat <JPEXPR <int-flag>>) and JASSERTLIS returns the l i s t of res u l t s returned from each JASSERT. J (J REMASSERT pat <|PEXPR>) | J JEXPRJ J (| FLAMBDA) J * j The rules for jEVALing and macro-expanding are the same as those for |ASSERT except that pat can also be of Appendix I 273 the form "/pattern-label". If t h i s i s the case the pattern of that name in JPEXPR w i l l be removed; for any other kind of pattern, JREMASSERT w i l l look through JPEXPR for a pattern matching pat and remove the f i r s t one i t finds (no f a i l u r e to match processing takes place). After removing the pattern, JREMASSERT looks to the pattern head for a pattern of the form (IE-REMOVED head ?pattern !(JPROG () ... )) Which w i l l take care of any s i d e - e f f e c t s of the pattern removal. JREMASSERT returns the pattern which was removed. J (| EL N 1 pat) i i i Returned as value from this EXPR w i l l be the N 1 - t h element of pat. 11*2 Objects for Searching 3 I (J SEARCH t e s t - f n expand-fn <start-|PEXPR <restart») J J JEXPRJ i (JLAMBDA) J i j This i s J L I S P * S breadth-first searching routine, test-fn and expand-fn are either JEXPRs or J L A M B D A Appendix I 274 expressions of one argument. start-|PEXPSs (default a l i s t containing the current execution instance) i s given as argument to t e s t - f n which either returns NIL or non-null. I f non-null, the search terminates with that as the answer. If NIL, the search continues with expand-fn being executed with the l i s t start-iPEXPRs as argument. expand-fn returns either NIL or a l i s t of jPEXPR names into which the search i s to expand. In the former case the search terminates with a NIL answer; in the l a t t e r case the l i s t of newly expanded names i s passed to test-fn to see i f i t approves. If not, then another round of expansion must take place; i f so, the value returned from t e s t - f n i s returned as answer. Note that a l l jEVALing takes place i n the execution instance which i n i t i a t e d the search (although, naturally, the functions themselves can send messages to other objects i f so desired). The l a s t argument, " r e s t a r t " , i f given indicates that the search can be restarted. I t i s the name under which i s stored a l l data needed to r e s t a r t a search. Thus, i f the answer returned from a supposedly successful search l a t e r turns out to be inadeguate, new answers can be generated. This i s just the c a p a b i l i t y for generators (see CONNIVER, McDermott and Sussman (1974)). If no restar t i s s p e c i f i e d , or i f expand-fn ever returns NIL, then no data i s stored for r e s t a r t (since there would be no point). Appendix I 275 | (j NEXT—SEARCH search-name) j I i EXPR| i ( (LAMBDA) | *- : j This i s used to r e s t a r t any search formerly suspended under the name "search-name". The search proceeds normally from where i t l e f t o f f . 1 1 • 8 Objects Involved i n Saying Stacks r ^ JUAU-REVOIR AO A1 <A2>) | i EXPRi i (LAMBDA) | t j Al and A2 are arguments l i k e those of |RETURN, that i s they indicate a value and a return point on the current execution instance stack., I f 12 i s omitted, the nearest enclosing |PROG or (EVENT-SEQUENCE i s assumed to be the return point. The additional argument AO designates the place to save the portion of the stack stretching back from the (AU-REVOIR form to the A2 form. A pattern (ISTACK-SAVE current-ex-inst AO { "the stack" )) i s used for such storage. As i s the case with JRETURN, i f A2 i s the keyword (HANDLER, control goes back to the matcher within the message handler for the current execution instance; and i f A1 i s NIL, the match w i l l f a i l at that point. I f f a i l u r e Appendix I 276 to match processing f a i l s to r e c t i f y the s i t u a t i o n , then an (AU-REVOIR return condition (|RETORN-COND ex-environ-ex-inst (AU-REVOIR (current-ex-inst AO) NIL) i s set up i n the execution environment execution instance. I f , on the other hand, f a i l u r e to match does succeed i n finding a matching pattern, then (J RETURN—COND ex-environ-ex-inst 1A U-RE VOIR (current-ex-inst AO) matching-pat) w i l l be set up i n ex-environ-ex-inst. In either case, the stack has been saved so that control can be resumed i f somebody up there wants to |RESTART the JAU-REVOIRed execution instance. j {)RESUME AO <S1>) j i EXPR| I (LAMBDA) } i. j This i s the object used to resume the execution of the stack stored with AO. The stack i s restored by replacing the (RESUME (EVAL block with the old stack and the old (AU-REVOIR |EVAL block by SI, i f given ( i f not given, the value o r i g i n a l l y returned by |AU-REVOIR i s substituted). Execution can then resume with the restored portion of the stack going f i r s t . Use of (RESUME in conjunction with |AU-REVOIR e f f e c t i v e l y give a co-routining c a p a b i l i t y within an execution instance. Note that i n c o m p a t i b i l i t i e s are a l l too possible Appendix I 277 between the current stack and the restored stack; i t i s up to the user to be ca r e f u l when using these functions, also do not confuse |RES UME, used within an execution instance, with (RESTART, used from one execution instance to restar t another. r 1 J {(RESTART old-ex-inst <A0 <S1>>) j I EXPR | 1 {LAMBDA) ( < j This object allows the re s t a r t of an execution instance previously suspended by an interrupt or an JAU-REVOIR. If old-ex-inst was suspended by an interrupt, AO and S1 cannot be s p e c i f i e d and the execution instance from which the command was issued should l i e i n the execution environment of old-ex-inst. If these c r i t e r i a are met, old-ex-inst i s scheduled with a l l i t s pointers intact and control i s passed to the scheduler. If old-ex-inst was suspended by an JAU-REVOIR, then AO, the marker under which the old stack i s stored, must be sp e c i f i e d . S1 has the same meaning as for JRESUME. J RESTART w i l l create a new execution instance, with EX-INSTANCE-OF pointer to old-ex-inst and EX-ENVIRON pointer to the execution instance which issued the J RESTART. The stack of t h i s instance w i l l be i n i t i a l i z e d to the stack stored under AO i n old-ex-inst, with the same r e s t r i c t i o n s as i n |RESUME. This new execution instance i s put on the execute gueue (with the same p r i o r i t y as Appendix I 278 old-ex-inst) and control resumes i n the scheduler. Eventually, the new execution instance w i l l run and when finished w i l l return to the (RESTART execution instance rather than the o r i g i n a l old-ex-inst EX—ENVIRON execution instance. Note of i n t e r e s t : what has been created here i s an execution instance of an execution instance where the "higher" execution instance points to the old EX-ENVIRON and the "lower" execution instance points to the new EX-ENVIRON. This somewhat simulates the ALINK / CLINK d i s t i n c t i o n of the Bobrow and Wegbreit (1973) control scheme in that i t allows the |RESTART and IAU-8EV0IR environments to be kept d i s t i n c t . However, most searches, as currently designed, w i l l always search the new execution environment even i f (as would often be the case a f t e r a |RESTART) the old execution environment i s more appropriate. Similar problems would arise when looking through old episodes i n memory. A1.9 Special Purpose Objects J (|EVENT-SEQUENCE (locals) S1 S2 ... Sn) | 1 JEXPR| 1 { | FLAMBDA) | i. J This i s a spe c i a l purpose object whose format i s very s i m i l a r to that of a JPROG. The action of the object i s Appendix I 279 very s i m i l a r to (PROG in that the loc a l s are bound to NIL on the current stack, and the Si are executed i n sequence S1, S2, ... (unless over-ridden by a JGO). The difference l i e s i n the meaning of an atomic S i , say STEPk; whereas i n a (PROG STEPk would be ignored except as a label for a jGO, in an |EVENT-SEQUENCE i t i s a signal that another "step" i n the J EVENT—SEQUENCE i s about to take place. The next S j , (PEXPR-call, which i s a c a l l to a (PEXPR i s considered to be that step, and af t e r i t i s taken (that i s afte r the messages have been sent and the answer returned) |EVENT-SEQUENCE does some spe c i a l processing. It asserts the following two patterns: (STEP current-ex-inst STEPk |PEXPR-call-ex-inst) i s asserted in the current execution instance; and (THEN STEPk-1 | PEXPR-call-ex-inst) i s asserted i n the execution instance of the previous step ( i . e . STEPk-1). These two types of pattern e s s e n t i a l l y allow the preservation of a permanent record of the episode undertaken by the |EVENT-SEQUENCE, a record which can be accessed from the current execution instance by looking at STEPk patterns and which can be traversed i n seguential order from beginning to end along THEN l i n k s . The following idiosyncracies should be noted: there i s obviously no THEN pattern to the f i r s t step; i f no (PEXPR c a l l s are found before the next step i s encountered, (EVENT-SEQUENCE ignores the missing step; i f more than one appendix I 2 8 0 |PEXPR c a l l i s entered into before the next step, jEVENT-SEQUENCE ignores a l l but the f i r s t as f a r as keeping a record of them i s concerned. Termination conditions f o r and values returned from |EVENT-SEQUENCE are i d e n t i c a l to JPROG. J (1 DO-PARALLEL (L1 ... Ln) <UNTIL test-cond>) | I IEXPRJ i (| FLAMBDA) | v j ]DO-PARALLEL i s a ]EXPR which di r e c t s the p a r a l l e l execution of L1 through Ln each of which i s assumed to be a c a l l to a JPEXPR. JDO-PARALLEL w i l l jEVAL each of the L i in turn, and w i l l also JEVAL test-cond (an arb i t r a r y atom, |EXPR, J PEXPR, EXPR, or lambda of some description - i f unspecified, i t i s assumed to always be NIL). When test-cond JEVALs to something other than NIL, JDO-PARALLEL i s finished and returns the value returned from test-cond as r e s u l t . Otherwise, i t keeps cycling around the L i , jRESTARTing any that have been interrupted. I t may eventually be the case that none of the L i can be JRESTARTed, having exceeded their J END= conditions, in which case J DO-PARALLEL w i l l also cease and return NIL as value. JDO-PARALLEL i s useful i f several things need to be done at once. Note that the user can specify the interrupt conditions on the L i to achieve any kind of time s l i c i n g desired. Appendix I 281 APPENDIX II Concert Scenario |PEXPRs This Appendix presents some of the more elaborate pattern expressions which arise i n the examples of Chapter V . The Appendix i s divided into two parts, the f i r s t part ou t l i n i n g jPEXPRs which are needed for Conversation I (the t i c k e t buying conversation), and the second part outlining jPEXPRs which are needed for Conversations II and III (the drink buying conversation and the conversation with a friend at intermission). 42.1 Conversation I <JPDEF ATTEND-CONCERT (SUPERSET ATTEND-CONCERT ATTEND) (EXECUTE ATTEND-CONCERT SELF 7THIS—CON CERT ! (J EVENT-SEQUENCE {) (j ASSERT (ATTENTION SELF 1THIS-CONCERT) ) (JASSERT (PURPOSE SELF (ATTEND SELF !THIS-CONCERT) ) ) (jSETQ LOC-CONCERT (IPOINTER LOCATION THIS-CONCERT)) STEP 1 ;go to theatre (GOTO (EXECUTE GOTO SELF !LOC-CONCERT ?GO-PLACE1)) (CHECK-FAILURE) (ITHIS-CONCERT (ENTRANCE-REQUIREMENT !THIS-CONCERT 7DESIRED-TICKET)) (JASSERT (EVENT !DESIRED-TICKET !THIS-CONCERT) DESIRED-TICK ET) STEP2 ;buy t i c k e t (BUY (EXECUTE BUY SELF !DESIRED-TICKET 7BUY-RES0LT) ) (CHECK-FAILURE) STEP3 ;go into lobby (JSETQ LOBBY {JPOINTER LOBBY LOC-CONCERT)) (GOTO (EXECUTE GOTO SELF !LOBBY 7GO-PLACE2) ) (CHECK-FAILURE) STEP4 ;go to seat Appendix II 282 (|SETQ SEATS ((POINTER REPN DESIRED-TICKET)} (GOTO {EXECUTE GOTO SELF ! SEATS 7GO-PLACE3) ) (CHECK-FAILURE) STEP5 j l i s t e n to f i r s t half of concert (SETQ THIS-AGENDA {(POINTER AGENDA THIS-CONCERT)) (|PATTERN (FIRST-HALF !THIS-CONCERT ?BEGIN-PROGRAM) THIS-AGENDA) (LISTEN (EXECUTE SELF IBEGIN-PROGRAM 7FIRST-DONE) ) (CHECK-FAILURE) STEP6 ;go back to lobby (GOTO (EXECUTE GOTO SELF !LOBBY 7IM-LQBBY)) (CHECK-FAILURE) STEP7 ;buy a drink (| SETQ BAR—WHERE (| POINTER BAR LOC-CONCERT) ) {(PATTERN {WANT SELF (DRINK SELF 7DESIRED-DRINK) ) PRE-DINNER-DRINK) {BOY (EXECUTE BUY SELF 'DESIRED-DRINK ?BUY-DONE)) (CHECK-FAILURE) STEPS ; f i l l -in-time and drink beverage u n t i l buzzer {|DO-PARALLEL ({FILL-IN-TIME (EXECUTE FILL-IN—TIME SELF ? END-FILL) (( TI M E= 5)) (SIP (EXECUTE SIP SELF JDESIRED-DRINK 7DRIMK—RESULT) { ( TIM E= 1)) ) UNTIL (NOT (NULL (CHECK-FOR-ACTIVE-SUBSET BUZZER-SOUND)))) (CHECK-FAILURE) STEP9 ;go back to seat (GOTO (EXECUTE GOTO SELF 'SEATS 7IN-S EATS)) (CHECK-FAILUR E) STEP 10 ; l i s t e n to second half of the concert {(PATTERN (SECOND-HALF ITHIS-CONCERT ?END-PROGRAM) THIS-AGENDA) (LISTEN (EXECUTE LISTEN SELF !END-PROGRAM ?SECOND-DONE)) (CHECK-FAILURE) STEP11 ;go back home (GOTO (EXECUTE GOTO SELF HOME 7BACK-H0ME) ) (CHECK-FAILURE) {j RETURN (J CURRENT)) )) > Appendix II 283 <|PDEF BUY (SUPERSET BUY ACTUAL-TRANSACTION) (EXECUTE BUY 7BUYER 7ITEM ! (EVENT-SEQUENCE {) (| AND (NEQ BUYER 'SELF) (J ASSERT (FAIL (NOT SELF BUYER) ) ) (}RETURN NIL)) (|PATTERN (LOCATION !ITEH ?PLACE-ITEH) ITEM) { J PATTERN (SELLER 2 ITEM ?SELLER) ITEM) STEP 1 ;go to t i c k e t booth (GOTO (EXECUTE GOTO SELF !PLACE-ITEM 7GOT-THERE)) (CHECK-FAILURE) (JASSERT (BUYER ! ITEM 'BUYER)) ( J ASSERT (SELLER 2 ITEM 2 SELLER) ) (J ASSERT (PURPOSE !SELLER (SELL !SELLER IITEM))) (J ASSERT (PURPOSE 2 BUYER (BOY ! BUYER IITEM))) {J ASSERT (ATTENTION !BUYER 2 ITEM)) STEP2 ;take part i n conversation to buy t i c k e t (BUY-CONVERSATION (EXECUTE BUY-CONVERSATION 2 BUYER 'SELLER IITEM 7CONV-R ESULT) ) (CHECK-FAILURE) { J RETURN (J CURRENT) ) )) > <JPDEF BUY-CONVERSATION (SUPERSET BUY-CONVERSATION SOCIAL-TRANS ACT!ON-CONVERATION) (EXECUTE BUY-CONVERSATION 7BUYER 7SELLER 7ITEM ! (EVENT-SEQUENCE () STEP 1 ;start up conversation (WHAT-DO-YOU-WANT (EXECUTE WHAT-DO-YOU-WANT 2 SELLER I BUYER 7WHAT-WANT-CONV) ) (CHECK-FAILURE) (TIE-IN WHAT-WANT-CONV) (JPATTERN (WANT !BUYER (EXCHANGE 7BUYER-HAS 7 BUY ER-WANTS) ) BUYER) { J PATTERN (WANT !SELLER (EXCHANGE 7SELLER-HAS 7SELLER—WANTS)) SELLER) STEP2 ;bargain over what buyer wants (BARGAIN (EXECUTE BARGAIN !SELLER 2BUYER 2 SELLER-HAS !BUYER—WANTS IITEM 7BARGAIN-1-CONV)) (CHECK-FAILURE) (TIE-IN BARGAIN-1-CONV) STEP3 ;bargain over what s e l l e r wants (BARGAIN Appendix II 284 (EXECUTE BARGAIN I BUYER !SELLER tBUYER-HAS !SELLER—IANTS !ITEM ?BARGAIN-2-C0NV)) (CHECK-FAILURE) (T IE- IB BARGAIN-2—CONV) STEP4 ;exchange cost of item for i t e (EXCHANGE (EXECUTE EXCHANGE !BUYER !SELLER ! (1 POINTER COST ITEM) !ITEM ?CONV-EXCHANGE)) (CHECK-FAILURE) (TIE-IN CONV-EXCHANGE) STEP5 ;close out the conversation (FAREWELL (EXECUTE FAREWELL 'BUYER !SELLER 7G00MBYE)) (CHECK-FAILURE) (TIE-IN GOOMBYE) { | RETURN ((CURRENT)))) > <|PDEF WHAT-DO—YOU-WANT (SUPERSET WHAT-DO-YOU-iANT GREETING) (EXECUTE WHAT-DO-YOU-WANT 7SPEAKER1 ?SPEAKER2 ! (EVENT-SEQUENCE () (J SETQ DIRECTIONS (ESTABLISH-IDENTITIES SPEAKER 1 SPEAKER2) ) (JSETQ DIRECTION—FIRST (CAR DIRECTIONS) ) ((SETQ DIRECTION-SECOND (CADR DIRECTIONS)) STEP 1 ;speaker1 inguires as to purpose of speaker2 {|APPLY 'INQUIRE DIRECTION-FIRST 'INQUIRE SPEAKER 1 SPEAKER2 -.(PURPOSE ! SPEAKER2 U^NKNOWN*) «?NEW-UTT1) (CHECK-FAILURE) (TIE-IN NEW-UTT1) STEP2 ;speaker2 responds with his purpose ((APPLY 'RESPOND DIRECTION—SECOND * RESPOND SPEAKER2 SPEAKER1 %(PURPOSE !SPEAKER2 ?WHAT-PURPOSE) >?NEW-UTT2) (CHECK-FAILURE) (TIE-IN NEW-UTT2) {(RETURN {(CURRENT)))) > Appendix II 285 <|PDEF BARGAIN (SOPEBSET BARGAIN SOCIAL-TRANSACTION-CONVERSATION) (EXECUTE BABGAIN ?QOESTIONEB ?BESPONDER 7POSN-Q 7POSN-R ?ITEM ! (EVENT-SEQUENCE () (JSETQ DIRECTIONS (ESTABLISH-ID ENTITIES QUESTIONER BESPONDEB)) (JSETQ DIRECTION-QUESTIONER (CAB DIBECTIONS)) (JSETQ DIRECTION—BESPONDER (CADR DIRECTIONS)) (JSETQ ORDER-Q (J POINTER BARG AI N-OBDE R POSN-Q) ) (JSETQ ORDER-R (IPOINTER BARGAIN-ORDER POSN-R) ) STEP1 ; f i r s t set up i n i t i a l bargaining positions {|SETQ CURRENT-ISSUE (CAB ORDER-Q)) (JCOND {(NULL CORBENT-ISSOE) (JSETQ COBBENT-ISSOE (CAB OBDEB-fi) ) (| AND (NULL CURBENT-ISSUE) {J AO-REVOIR 1 AGAIN (J CURRENT))) (| SETQ ORDER-R (CDB ORDER-R))) (T {| SETQ ORDER-Q (CDR ORDER-Q)))) (JSETQ STANCE-Q (MOST-IMPOSTANT { 1CUBBENT-ISSUE ! ITEM ?WH AT 1) POSN-Q QUESTIONEB 'NEXT-STANCE-Q)) {JSETQ STANCE-B (MOST-IMPOSTANT (ICUBBENT-ISSUE !ITEM ?WHAT2) POSN-B BESPONDEB »NEXT-STANCE-B)) (JCOND ({JAND (NULL STANCE-Q) (NOLL STANCE-R)) (JAO-REVOIR 'AGAIN (J COBBENT) ) ) ( (NOLL STANCE-Q) (JSETQ STANCE-Q (LIST CUBBENT-ISSUE ITEM * = {X T) ) ) ) { (NULL STANCE-R) {JSETQ STANCE-R (LIST CURRENT-ISSUE ITEM * = (X T) ) ) ) (T T)) (JSETQ STANCE-TEM-Q STANCE-Q) (JSETQ ST ANCE—T EM-R STANCE-R) ;guestioner asks for responder's stance {J APPLY 'INQUIRE DIRECTION-QUESTIONER 'INQUIRE QUESTIONER RESPGNDER (ICURRENT-ISSUE 'ITEM *UNKNOWN*) • 7UTT-Q) (CHECK-FAILURE) (TIE-IN UTT-Q) STEP2 ;responder r e p l i e s with his current stance (JAPPLY 'RESPOND DIRECT10N-RESPON DER 'RESPOND RESPONDER QUESTIONER STANCE-R '7UTT-R) (CHECK-FAILURE) (TIE-IN UTT-B) STEP3 ;guestioner concocts a reply {|SETQ STANCE-B (COVES—PATTERN STANCE-R (IPOINTER CONTENT UTT-R) ) ) (JAND (NULL STANCE—B) Appendix II 286 (EXPLAIN-BAD (EXECUTE EXPLAIN—BAD !UTT-R 7EXPLAIN-ANS) ) ) { 1 SETQ COMP-PAT (J MATCH STANCE-R {| CURR ENT) STANCE-Q tl CURRENT))) (JCOND ((NULL COMP-PAT) ((SETQ STANCE-TEM-Q (JRESUME ' NEXT-STANCE-Q) ) (JCOND ((NULL STANCE-TEM-Q) {(AND (NULL STANCE-TEM-R) ((SETQ FIRST-IN T) {(GO 'STEP7))) (T ({SETQ STANCE-Q STANCE-TEM-R))) {{APPLY 'INQUIRE DIRECTION-QUESTIONER QUESTIONER RESPONDER STANCE-Q •? UTT-Q) (CHECK-FAILURE) (TIE-IN UTT-Q) (|GO 'STEP4)) (T (| ASSERT ICOMP-PAT ITEM) ({GO 'STEP5))) STEP4 ;responder concocts a reply ((SETQ STANCE-Q (COVER-PATTERN STANCE-Q ({POINTER CONTENT UTT-Q)) ({AND (NULL STANCE-Q) (EXPLAI N-BAD (EXECUTE EXPLAIN-BAD !UTT-Q 7EXPLAIN-ANS) ) ) { | SETQ COMP-PAT { J MATCH STANCE-Q {(CURRENT) STANCE-R ((CURRENT))) (JCOND ((NULL COMP-PAT) {|SETQ STANCE-TEM-R {{ RESUME ' NEXT-STANCE-R) ) (JCOND ((NULL STANCE-TEM-R) {J AND (NULL STANCE-TEM-Q) { J SETQ FIRST-IN T) {JGO 'STEP8))) (T (J SETQ STANCE-R STANCE-TEM-R))) (J APPLY 'RESPOND DIRECTION-RESPONDER RESPONDER QUESTIONER STANCE-R '7UTT-R) (CHECK-FAILURE) (TIE-IN UTT-R) (|GO *STEP3)) (T (J ASSERT ! COMP-PAT ITEM) {JGO ' STEP6) ) ) STEP5 ;agreement reached by guestioner ((APPLY 'AGREE DIRECTION-QUESTIONER 'AGREE QUESTIONER RESPONDER COMP-PAT •7UTT-Q) (CHECK-FAILURE) (TIE-IN UTT-Q) (JGO ' STEP 1 ) ( STEP6 ;agreement reached by responder (JAPPLY 'AGREE DIRECTION-RESPONDER 'AGREE RESPONDER QUESTIONER COMP-PAT '?UTT-fi) Appendix II 287 (CHECK-FAILURE) (TIE-IN UTT-R) ((GO 'STEP1) STEP7 jguestioner i r r e c o n c i l a b l y disagrees with STANCE-R ((APPLY 'DISAGREE DIRECTION-QUESTIONER * DISAGREE QUESTIONER $ESPONDER STANCE-R »?UTT-Q) (CHECK-FAILURE) (TIE-IN UTT-Q) (JCOND (FIRST-IN {| SETQ FIRST-IN NIL) (JGO ' STEP8) ) (T (JGO ' STEP9) ) ) STEP8 ;responder i r r e c o n c i l a b l y disagrees with STANCE-Q (JAPPLY 'DISAGREE DIRECT!ON-RESPONDER 'DISAGREE RESPONDER QUESTIONER STANCE-Q '7UTT-R) (CHECK-FAILURE) (TIE-IN UTT-R) (JCOND (FIRST-IN (J SETQ FIRST-IN NIL) (JGO ' STEP7) ) (T (| GO ' STEP9) ) ) STEP9 ; f i n i s with f a i l u r e { | ASSERT -.(FAIL ! STANCE—Q ! STANCE-R) ) (JAU-REVOIR 'AGAIN NIL) (JGO »STEP1) ) ) > <|PDEF SELF-HAS-TICKET-BARGAINING-POSN (SUPERSET SELF—HAS-TICKET-BARGAINING-POSN HAS-BAR GAINING—POSN) 51 : (COST yTICKET—FOR-CONCERT yDOLLARS-5) 52 : (COST f/TICKET—FOR-CONCERT fDOLLARS-10) (IMPORTANCE SELF /S1 10) (IMPORTANCE SELF /S2 9) (BARGAIN-ORDER SELF-HAS-TICKET-BARGAIMNG-POSN (COST)) > <|PDEF TICKET-SELLER-WANTS-BARGAINING-POSN (SUPERSET TICKET-SELLER-WANTS-BARGAINING-POSN WANTS-BARGAINING-POSN) S1 : (COST frTICKET !(|POINTER COST TICKET)) (IMPORTANCE ^TICKET-SELLER /S1 10) (BARGAIN-ORDER TICK ET—SELLER-WANTS-BARGAINING-POSN (COST)) > Appendix II 288 <|PDEF EXCHANGE (SUPERSET EXCHANGE ACTUAL-TRANSACTION) (EXECUTE EXCHANGE 7PERS0N1 7PERSON2 7ITEM1 7ITEM2 ! (EVENT-SEQUENCE {) (|SETQ DIRECTIONS (ESTABLISH-IDENTITIES PERS ON1 PERSON2)) (J SETQ DIRECTION-FIRST (CAR DIRECTIONS)) (J SETQ DIRECTION-SECOND (CADR DIRECTIONS)) STEP1 ;person 1 gives iteml to person2 {(APPLY 'GIVE DIRECTION-FIRST 'GIVE P ER SON1 PERSON2 ITEM 1 ?GIVE-RESULT) (CHECK-FAILURE) STEP 2 ;person2 thanks him for i t {|APPLY 'THANKS DIRECTION-SECOND 'THANKS PERSON2 PERSON 1 ITEM1 ?THANKS-UTT1) (CHECK-FAILURE) (TIE-IN THANKS-UTT1) {(AND (NULL (] RETVALUE) ) ( (SETQ RUDE-FLAG T) ) STEP3 ;person2 gives item2 to personl ((APPLY 'GIVE DIRECTION—SECOND 'GIVE PERSON2 PERSON 1 ITEH2 7GIVE-RESULT2) (CHECK-FAILURE) STEP 4 ;person1 thanks him for i t i f person2 was p o l i t e (ICOND (RUDE-FLAG) (T ((APPLY 'THANKS DIRECTION-FIRST 'THANKS PERSON 1 PERS0N2 ITEM2 7THANKS—UTT2) (CHECK-FAILURE) (TIE-IN THANKS-UTT2) ) ) ((RETURN ((CURRENT)))) > <JPDEF FARESELL (SUPERSET FAREWELL DIALOGUE) (EXECUTE FAREWELL 7PERS0N1 ?PERSON2 ! (EVENT-SEQUENCE () {(SETQ DIRECTIONS (ESTABLISH-IDENTITIES PERSON 1 PERSON2) ) (|SETQ DIRECTION-FIRST (CAR DIRECTIONS)) ((SETQ DIRECTION-SECOND (CADR DIRECTIONS)) STEP 1 ;personl says goodbye to person2 {(APPLY 'GOODBYE DIRECTION-FIRST 'GOODBYE PERSON1 PERSON2 #ANY 7CONV-1) (CHECK-FAILURE) (TIE-IN CONV-1) STEP2 ;person2 says goodbye to personl Appendix II 289 (|APPLY * GOODBYE DIRECTION-SECOND 'GOODBYE PERSON2 PERSON1 #ANY 7CONV-2) (CHECK-FAILURE) (TIE-IN CONV-2) (|RETURN (|CURBENT)))) > <JPDEF INQUIRE (SUPERSET INQUIRE INTERROGATIVE) (EXPECT INQUIRE ?SPEAKER 'LISTENER 7CONTENT UIPROG () %(SURFACE £WHAT—|PEXPR 7UTTERANCE) {|COND ({NULL UTTERANCE) {|SETQ UTTERANCE {HEAR-WORDS) ) (|ASSERT (SURFACE $|CURRENT !UTTERANCE)) (| SETQ APPROP-SUBSET (CHECK-FOR-ACTIVE-SUBSET •INQUIRE)) (JCOND ( (NULL APPROP-SUBSET)) (T (REPLACE APPROP-SUBSET)))) (T { J ASSERT (SURFACE $ JCURRENT 1 UTTERANCE) )) ) { }ASSERT (SPEAKER $ J CURRENT !SPEAKER) ) {|ASSERT (LISTENER $ J CURRENT 'LISTENER)) (JAND (NEQ (LAST UTTERANCE) "?") ( J ASSERT (FAIL (NOT INQUIRE ! UTTERANCE) ) ) {J RETURN NIL)) (INQUIRE-CLAUSE (INTERPRET INQUIRE-CLAUSE 'UTTERANCE 7RESULT) ) (CHECK-FAILURE) (JASSERT (CONTENT $|CURRENT ! (JPOINTER CONTENT RESULT))) { J RETURN (JCURRENT)))) (EXECUTE INQUIRE 7SPEAKER 7LISTEN ER ?CO NT ENT '{JPROG {) (JCOND ((JUNASSIGNED CONTENT) (JSETQ CONTENT »*UNKNOWN*) (NOUNG (GENERATE NOUNG *UNKNOWN* TOUT))) (T (INQUIRE-CLAUSE (GENERATE INQUIRE-CLAUSE 'CONTENT ?OUT)))} (JSETQ DOWN-JPEXPR (CAR (J RETCO DES) )) (JSETQ OUT (SPEAK-WORDS (APPEND 1 OUT "?"))) { | ASSERT (SPEAKER $ J CURRENT ! SPEAKER) ) (|ASSERT (LISTENER $ J CURRENT 'SPEAKER)) {(ASSERT (SURFACE $ J CURRENT iOUT)) (JASSERT (CONTENT $JCURRENT !(JPOINTER CONTENT DOWN-JPEXPR))) {|RETURN (JCURRENT)))) > Appendix I I 290 <|PDEF YES2 {SUPERSET YES2 INQUIRE) {EXPECT YES2 7SPEAKER 7LISTENER 7CONTENT !(JPBOG () % {SURFACE 0WHAT- JPEXPR 7UTTERANCE) {JCOND { (NULL UTTERANCE) (JSETQ UTTERANCE (HEAR—WORDS)) (J ASSERT {SURFACE $ J CURRENT i UTTERANCE) ) (J SETQ APPROP-SUBSET {CHECK-FOR-ACTIVE-SUBSET 'YES2)) (JCOND { (NULL APPROP-SUBSET) ) (T (REPLACE APPROP-SUBSET)))) (T (J ASSERT (SURFACE $ (CURRENT i UTTERANCE) ) ) ) {J ASSERT (SPEAKER $ J CURRENT !SPEAKER) ) {JASSERT (LISTENER $ J CURR ENT 'LISTENER)) { J AND (J UNASSIGNED CONTENT) {| SETQ CONTENT -i {PURPOSE !LISTENER *UNKNOWN*))) (JCOND {(EQUAL UTTERANCE •("YES" "?") ) (JASSERT (CONTENT $ JC URRENT -'CONTENT)) {J RETURN { J CURRENT) ) ) (T (JASSERT (FAIL (NOT YES2 ! UTTERANCE) ) ) (J RETURN NIL) ) ) ) ) (EXECUTE YES2 7SPEAKER ?LISTENER 7CONTENT MJPROG {) (JASSERT (SPEAKER $ J CURRENT !SPEAKER)) (JASSERT (LISTENER $ J CURRENT ! LISTENER) ) (JAND ( ] UNASSIGNED CONTENT) (J SETQ CONTENT -.{PURPOSE ILISTENER *UNKNOWN*))) (JASSERT (CONTENT $ J CURRENT 'CONTENT)) (JSETQ OUTPUT (SPEAK-WORDS » ("YES" "?"))) {J ASSERT (SURFACE $|CURRENT !OUTPUT)) (JRETURN {JCURRENT)))) {ASSOC YES2 !{J PROG {) (JCOND {{EQ (J POINTER EX-INSTANCE-OF (JPOINTER EX-ENVIRON)) "YES") (JASSERT (WANT-TO-GO YES2))) (T (SPREAD-ASSOC *PART-OF 'DEMON))))) > hr2..2 Conversations I I and. I l l <JPDEF PRE-DINNER-DRINK (SUPERSET PRE-DINNER-DRINK ALCOHOLIC-DRINK) (WANT SELF MJPROG {) %(ATTENTION SELF 7CUR-EVENT) (JCOND ({SUBINSTANCE CUR-EVENT 'CONCERT) (|RETURN '(DRINK SELF Appendix II 291 yJOH N N Y - W A L K E K - S C O T C H ) ) ) ( T { | R E T U R N * ( D R I N K S E L F Y F I V E - S T A R - R Y E ) ) ) ) } ) { L O C A T I O N f P R E - D I N N E R - D R I N K ! ( | P R O G { ) % ( A T T E N T I O N S E L F ? C U R - E V E N T ) ( \ R E T U R N ( J P O I N T E R B A R { | P O I N T E R L O C A T I O N C U R - E V E N T ) ) ) ) ) > <|PDEF JOHNNY-1ALKER-SCOTCH (SUPERSET JOHNN Y-WALK ER—SCOTCH SCOTCH) (BRAND fJOHNNY—WALKER-SCOTCH JOHNNY—WALKER) (COST fJOHNNY—WALKER-SCOTCH fDOLLARS - 3 ) > <jPDEF SCOTCH (SUPERSET SCOTCH PRE—DINNER-DRINK) (SUPERSET SCOTCH AFTER-DINNER-DRINK) (HIXER fSCOTCH f I C E ) > <|PDEF ALCOHOLIC-DRINK (SUPERSET ALCOHOLIC-DRINK DRINK) (SELLER yALCOHOLIC-DRINK yBARTENDER) > < JPDEF BARTENDER (SUPERSET BARTENDER SELLER) (SELL fBARTENDER yALCOHOLIC-DRINK) (WANT fBARTEN DER (EXCHANGE BARTENDER-HAS-BARGAINING-POSN BA fiTENDER-WANTS-BARGAINING—POSN)) > < j PDEF SELF-AS-A-BUYER—OF-ALCOHOLIC-DRINK (SUPERSET SELF-AS-A-BUYER-OF-ALCOHOLIC-DRINK SELF-AS-A-BUYER) (BUY SELF yALCOHOLIC-DRINK) Ap p e n d i x I I 292 (WANT SELF (EXCHANGE S ELF-HAS—DRINK-BARGAINING-POSN SELF-WANTS-DRINK-BARGAINING-POSN)) > <|PDEF SELF-HAS-DRlNK-BARGAINING-POSN (SOPERSET S ELF-HAS-DRINK-BARGAINING-POSN HAS—BARGAINING—POSN) S1 : (COST tALCOHOLIC-DRINK ! ((POINTER COST ALCOHOLIC-DRINK)) (IMPORTANCE SELF /S1 10) (BARGAIN-ORDER SELF-HAS-DRINK-BARGAINING-POSN (COST)) > <(PDEF SELF-WANTS-DRINK-BARGAINING-POSN (SUPERSET SELF-WANTS-DRINK-BARGAINING-POSN WANTS—BARGAINING-POSN) 51 : (BRAND y ALCOHOLIC-DRINK •.{(POINTER BRAND ALCOHOLIC-DRINK) ) 52 : (MIXER fALCOHOLIC-DRINK !{|POINTER MIXER ALCOHOLIC-DRINK)) (IMPORTANCE SELF /SI 8) (IMPORTANCE SELF /S2 10) {BA RG AIN-OR DER ALCO HOLIC-DRIN K—BARGAINING-POSN (BRAND MIXER)) > < J PDEF BARTENDER-HAS-BARGAINING-POSN (SUPERSET BART ENDER—HAS-BARGAINING-POSN HAS-B ARGAINING-POSN) 51 : (MIXER tALCOHOLIC-DRINK !{(POINTER MIXER ALCOHOLIC-DRINK)) 52 : (BRAND VALCOHOLIC-DRINK 1 ((POINTER BRAND ALCOHOLIC-DR IN K) ) (IMPORTANCE fE-ARTENDEE /S1 6) (IMPORTANCE fBARTENDER /S2 6) (BARGAIN-ORDER BARTENDER-HAS-BARGAINING-POSN (BRAND MIXER) ) > Appendix I I 293 <|PDEF BARTENDER-WANTS-BARGAIN!NG-POSN (SUPERSET BARTENDER-WANTS-BARGAINING-POSN WANTS-BARGAINING-POSN) 51 : (COST fALCOHOLIC-DRINK !(INCREASE-BY DOLLARS-2 (IPOINTER COST ALCOHOLIC-DRINK))) 52 : (COST fALCOHOLIC-DRINK ! (| POINTER COST ALCOHOLIC-DRINK)) (IMPORTANCE tBARTENDER /S1 9) (IMPORTANCE fBARTENDER /S2 6) (BARGAIN-ORDER BARTENDEB-1ANTS-BARGAIN!NG-POSN (COST) ) > <JPDEF DIALOGUE (SUPERSET DIALOGUE MULTIPLE-SPEECH-ACTION) (EXECUTE DIALOGUE ?SPEAKER1 ?SPEAKER2 ! (EVENT-SEQUENCE {) (|SETQ DIRECTIONS (ESTABLISH-IDENTITIES SPEAKER 1 SPEAKER2 ) ) (| SETQ DIRECTION-FIRST (CAB DIRECTIONS)) (|SETQ DIRECTION-SECOND (CADR DIRECTIONS)) (| SETQ EXPECT 1 (COMPUTE-EXPECTATIONS S PEAK ER1 SPEAKER2)) STEP1 ;speaker1 makes an utterance (|APPLY ' SPEECH-ACT DIRECTION-FIRST 'SPEECH-ACT SPEAKER 1 SPEAKER2 EXPECT1 ?FIRST-UTT) (CHECK—F AILURE-DIALOGUE) (TIE-IN FIRST-UTT) (|SETQ EXPECT2 (COMPUTE—EXPECTATIONS SPEAKER2 SPEAKER 1)) STEP2 ;speaker2 makes an utterance (|APPLY 'SPEECH-ACT DIRECTION-SECOND 'SPEECH-ACT SPEAK ER2 SPEAKER 1 EXPECT2 ?SECOND-UTT) (CHECK-FAILUBE-DIALOGUE) (TIE-IN SECOND-UTT) (|GO 'STEP 1)) ) > Appendix II 294 INDEX This appendix contains a glossary of useful terms and object names indexed to t h e i r occurrence i n the text of the thesis. Some concepts occur i n more than one place, so are referenced by several page numbers. |AND .................................................. 26 4 | APPLY 263 i APPLY 1 263 JASSERT .................................................... 271 J ASSERTLIS 272 JAU-REVOIR 275 JCOND . ... 264 J CR EA TE-NE w ......................... ................... 266 J DEFUN 265 JDO-PARALLEL ........................................... 280 j DYNAMIC 266 JEL ......................................... 273 JEVAL 257 JEVAL block ................................ ...... 49 j EVENT-SEQUENCE 278 JEVLIS 263 J EXPR 37,44 JGO 26 4 JINTERRUPT-PROCESSING .... ...............................260 JMAP 264 J MATCH ,.. 268 J NEXT-SEARCH , 275 JOR 264 |PARALLEL .................................. .............. 76 I PATTERN 269 J PATTERN-ALL ............................................... 269 J PDEF 265 J PEXPR 38,43 j PEXPR-MH 261 JPOINTER 27 0 J POINTER-ALL ........................ .................... 270 J PROG 264 j REMASSERT 272 J RESTART 277 J RESUME 276 J RETURN 264 JRETURN-COND 267 J SCHEDULE 258 J SCHEDULER ..... 261 J SEARCH 273 J SET 263 Index 29 5 i SETQ 263 i UNASSIGNED 271 j UNEVAL .................................................... 263 1 UPDATE-TIMER 260 Conversation with a friend ................................. 122 Drink buying conversation ..................................121 Ticket buying conversation 119 Associative activation ............................. 171,213,229 AGENDA-CONCERT 1 ... 139 ALCOHOLIC-DRINK 291 ASSOC message .......................................... 171,213 ATTEND-CONCERT 126,138,281 Bargaining stance 160 BARGAIN ........ 157,285 BARTENDER 291 BARTENDER-HAS—BARGAINING-POSN ...........29 2 BARTENDER—WANTS-BARGAINING-POSN 293 BUY ...... 126,146,283 BUY-CONVERSATION 128, 150,283 Clause i n t e r p r e t a t i o n 181,219 Comparing pattern expressions 231 Concert scenario 118 Conversation with a f r i e n d ................................. 196 Current | PEXPR 46 CHECK-FAILURE 143 CHECK-FOR-ACTIVE-SUBSET .................................... 171 CONCERT 139 CONCERT1 . ... 132, 138 Dependency inheritance 202 Direct inheritance -. 201 Drink buying conversation .............................. 190,195 DIALOGUE . 196,293 Episodic memory 207 Execution environment ,49,205 Execution instance 48 EXCHANGE 165,288 EXECUTE message .................................... 136,155,211 EXPECT message 155,211 Fa i l u r e to match 52,212 Fundamental matching rule 55 FAREWELL 166,288 Garbage c o l l e c t i o n 225 Generating language .. 189,221 GENERATE message 212 HEAR-WORDS 170 Interpreter -. 37 Interpreting language 18 1,219 Interrupts 72 INQUIRE 12 8,16 9,289 INTERPRET message .......................................... 212 ISA environment ....................... ........ .......,,,49,199 J OHNNY-WALKER-SCOTCH 291 Language l e v e l 31,177,218 Learning ......227 Index 296 Macro " V ...........-..--....---.--.-.«.......-.- ....71 Macro " t " ................................................... 60 Macro «!» 57 Macro "$" ..................... 58 Macro "€" 61 Macro ............................................... . 72 Macro "/" 58 Macro "?" .. 59 Macro "#" .................................... ..59 Macro "=" 59 Macro "35" .................................... 72 Macro c o n f l i c t s ...,,.,.,....,,,......,...,..,........,.,,...63 Macro ":" 43 Matching ,54 Message 37,45,48, 104 Message form 45 META-VIEW .............................................. 126,136 MODIFY-HOW message 182,212 MOST-IMPORTANT 163 Noun group interpretation .............................. 185,219 Object 37 Par a l l e l i s m ................................................. 76 Pattern ................................. ................. 38 Pattern expression 38,43 Pattern matching macro .......... 56 P oi n ter .,.,..,..66 Preposition group inte r p r e t a t i o n 188 Primary pattern expression ................................. 125 Procedural attachment 103 PART-OF environment ...................................204 PRE-DINNER-DRINK 290 QET 139 Replacement of |PEXPRs 173 Response 37,45 Return condition ............................................ 51 Role instance 147,187 RESPOND .., 130 Scheduling .....................49 Sc r i p t .. 29, 150,214 Secondary pattern expression 125 Semantic network ............................................ 99 Sequencing of utterances , 164 Source object 55 Source pattern ,..,......,,..,...,,.,,.55 Speech act 30,168,216 Stack (JPEXPR) 46 SCOTCH ..................................................... 291 SELF 146 SELF-AS-A-BUYER-OF-ALCOHOLIC—DRINK 291 SELF—AS-A-B0YER—OF-CONCERT-TICKET .................... ., 157 S ELF—HAS-DRINK-BARGAIN ING-POSN 292 SELF-HAS-TICKET-BARGAINING-POSN ............................ 287 SELF-WANTS-BARGAINING-POSN .....159 SELF-WANTS-DRINK-BARGAINING—POSN 292 Index 297 SPEAK-WORDS .................... . ....... 176 Target object ............................................... 55 Target pattern 55 Ticket buying conversation ............................. 150,167 Time .223 TICKET 144 TICKET—FOR—CONCERT 133,144 TIC KET-FOR-CON CERT 1 133 TICKET-SELLER 133,149 TICKET-SELLER-HAS-BARGAINING-POSN ........ , ........... 158 TICKET-S ELLER—WANTS-BARGAINING-POSN 287 TICKET-SELLER 1 133,149 TIE-IN 151 TOP-VIEW 126,136 Utterance interpretation ...............................181,219 Verb group interpretation .............................. 188,219 WHAT-DO-YOU-WANT 128,155,284 WORLD-VIEW 126,137 YES2 ...... 129,174,290 Index 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            data-media="{[{embed.selectedMedia}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.831.1-0051793/manifest

Comment

Related Items