55
AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF COMPUTER SCIENCE F/0 9/2 ARTIFICIAL INTELLIGENCE PR09RAMMIN9 LAN0UA9ES FOR COMPUTER AIDE—ETC(U) SEP 77 C RIE9ER» H SAMET» J R0SENBER9 N0001*-76-C-0%77 UNCLASSIFIED TR-593 NL END -78

AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF COMPUTER SCIENCE F/0 9/2 ARTIFICIAL INTELLIGENCE PR09RAMMIN9 LAN0UA9ES FOR COMPUTER AIDE—ETC(U) SEP 77 C RIE9ER» H SAMET» J R0SENBER9 N0001*-76-C-0%77

UNCLASSIFIED TR-593 NL

END

-78

Page 2: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

•i.o ;.;:•

i.i

.25

JA IM

2.0

1.8

"4 II. 6

MICROCOPY RESOLUTION TES1 CHA.R1

NATIONAL BURIAII 01 STANDARDS l<ft.t-,<

Page 3: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

COMPUTER SCIENCE TECHNICAL REPORT SERIES

O 9 C

iss* * •;

UNTVERSITY OF MARYLAND COLLEGE PARK, MARYLAND

20742

*•>•' .'••--. •

• ". .^ -• . •du» aahi I, Hill. 'Ulli VTi 4-;>-A-+ lV

Page 4: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

• ——i

TR-595 September 1977

Artificial Intelligence Programming Languages

for Computer Aided Manufacturing

Chuck Rieger, Hanan Samet, Jonathan Rosenberg Department of Computer Science

University of Maryland College Park, Maryland 20742 D D C

RUnKnanns lOfTI

ffi

V

y«92"! ABSTRACT: Eight Artificial Intelligence programming languages (SAIL, LISP, MICROPLANNER, CONNIVER, MLISP, POP-2, AL and QLISP) are presented and surveyed, with examples of their use in an automated shop environment. Control structures are compared, and distinctive features of each language are highlighted. A simple programming task is used to illustrate programs in SAIL, LISP, MICROPLANNER and CONNIVER. The report assumes reader knowledge of programming concepts, but not necessarily of the languages surveyed.

This report was funded by the National Bureau of Standards,

and by the Office of Naval Research.

»turn -^•--jg--»^ '.iZitfl..

Page 5: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

CON NTS

1. Introduction

2. SAIL

2.1. Introduction 2.2. Associative Data Base 2.3. Data Management Facility 2.4. Control Structures 2.5. System Building Capabilities 2.6. Standardization

3. The LIST Family of Languages

3.1. LISP 3.1.1. LISP Data Structure 3.1.2. Property Lists 3.1.3. Representative LISP Data Structure Manipulating Function!

3.1.3.1. (MEMBER X Y) 3.1.3.2. (ASSOC X Y) 3.1.3.3. (SUBSI X Y Z) 3.1.3.4. (APPEND X Y)

3.1.4. LISP Data Types 3.1.5. LISP Functions 3.1.6. The PROG Feature 3.1.7. LISP Macros 3.1.8. Variable Scoping 3.1.9. LISP I/O 3.1.10. Garbage Collection 3.1.11. LISP as a Self-Contained System

3.2. M1CR0PLANNER 3.2.1. The MLCROPLANNER Database 3.2.2. MICROPLANNER Theorems 3.2.3. Heuristic Guidance of Theorem Application 3.2.4. Searching and Backup in MP 3.2.5. Other Representative MP Capabilities

3.2.5.1. (THFIND <mode> <variables> <skel> <body>) 3.2.5.2. (THMESSAGE <variables> <pattern> <bod/>)

3.3. CONNIVER 3.3.1. Frames, Au-revoir and Adieu

3.4. Efficiency of the LISP Language Family 3.5. Standardization of the LISP Language Family

4. Related Languages

4.1. AL 4.2. MLISP 4.3. POP-2

5. Examples

5.1. Introduction 5.2. SAIL

5.2.1. Sample Program 5.2.2. Commentary

5.3. LISP 5.3.1. Sample Program 5.3.2. Commentary

5.4. PLANNER (MICROPLANNER) 5.4.1. Sample Program 5.4.2. Commentary

5.5. CONNIVER 5.5.1. Sample Program 5.5.2. Commentary

6. Recommendations

7. Bibliography

8. Summary Chart

I

•Ml -••--•'-'- -—-:: —

Page 6: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

1« iDiES&UiliSQ

T Intell manufo "ICROP are d manufa for t contro The p featur comput manufa langua langua which enviro

his report oe •> gence pro), r»i cturi ng envlron L ANNER t CONNIV i st inct fro* cturing env i ron he devt lopnent I in addition t aper includes es of these er-automateu m cturi nc ge, (!)

task t a d iscu

ge, and (A) con are BIOS t d

nment •

scrib • ing cent. M« langu ments

of o the (1)

langu anufa nd ho ssion clusi es i ra

es s langu The

«LISP, ages CLesl high- simpl surve

ages cturin w it m s of 0 n s w i ble a

one r a?es in

langua POP-2

previou ie723 i level s e numer ys a nö

as t g envi läht be

the s th emph no app

ecent the

ges »At-, slyL n t ha ymbol ical

CO* hey ronme ex pr

tanca asi s lical

ly cont surv and use

t th ic p cont pari m ig

nt, esse rdiz on t le

dev ext eyed CLI

d ey P lann rol sons ht (2)

d as a t io he to

elopec of a con

are S SP. Thes in co* rovide c ing and of *ach of the be us a sampl a progr

n statu types o the aut

Artif puter- A1L, e tan* puter- apabiI superv ine t distin ed i e auto SRI in s of f fea omated

i c i« I a i at a LISP, uaut v aidta i t it. s i sory 00 lb • ct ive n a matte each each

turts -s hoj-

!

L - — - •^-iilltrtiiiü- - - -

Page 7: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

•-'•" ,M-mjmK mmmmm.miimvt., I [III •••HID "WWWWW m~~m*—^^

2. SAIL

2.1. Int ro Suit is D

.EAP Cfelaman69j LNöur60]

onoTj. ön The re for€,

SAIL has its origins in a merger of LEAP associative language, and a version of ALGOL 60 unlike most of the other artificial intelligence languages, it is net LISP-baseo. Insteao. it is a general purpose compiled language with on extensive run-time library of functions. As befits its ALGOL origins, SAIL has block structure and explicitly typed. statically scopec variables. The oata types available include INTEGER, REAL, STRINGS of arbitrary length, structure, pointer, LIST, SET, ITEM, and aggregates of the previous (i.e., ARRAYs).

Some of the separately be low . t he capab il i ty for CCO0ASYL71] data the system building facilities, current stanaardizatiun efforts

more important features of SAIL are discussec These include the associative data base facility,

of SAIL as a host language in a CODASYL uSdge caie management system, the control structures,

F inally , a summary is presented of

2.2. Associative Data base

SAIL contains an associative data base facility known as LEAP which is used for symbolic computations This enables the storage and retrieval of information oased on partial specification of the dato. Associative data is stored in the form of associations which are ordereo three-tuples cf ITEMs» aenotea as TRIPLES. Examples o* TRIPLES are :

FASTEN XOR FASTEN XOR FASTEN XOR

NAIL SCREW öOLT E

CQV HAMMER; EQV SCREWDRIVER; iV PLIER,

Associations may be conceptuaIizee as representing a form

relation of the

or Attrioute XOR Object EQV Value Attrioute (Object) = Value

Most programming languages (e.g., LISP) associative-like mechanism:

Given: Attrioute,Object Find: Va lue

provide the following

However, SAIL enaoles the programmer to specify any of the components of the association, ana then have the LEAP interpreter search the associative store for all triples which have the same items in the specified positions. For example, the ret rieve 11 items

FASTEN XOR

that can

NAIL

fasten a na iI: following may be useo tc

An ITEM is a constant and is similar to a LISP atom. Items have names ana may also oe typed so that data can be associated with them. An item may be declared, or created during execution from a storage pool of items by use of the function NEh. For example:

—. "•*»-fc^»-^.

Page 8: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

\immmmmmmm

RtAL ITEM VISE;

declares VISE to be an item which may have a datum of type reel associated with it» The datum associated with an item is obtained by use of the function DATUM. Thus, DATUM(VISE) might be interpreted äs the capacity of the vise*

In order to deal with items, the user has the capability of storing them in variables (ITEMVARs). SETs, LISTS, and associations. The distinction between SETs and LISTs is that an explicit order is associateo with trie latter, whereas there is no explicit order associateo with the former. In addition, an item may occur more than once in a List •

Associations ere ordered three-tuples of items and may themselvts be considered as items and therefore participate in other associations. Triples are added to the associative store by use of a v*KE statement and erased from the associative store by use of an ERASE statement. For example, the following code could be used to detach assembly 1 freu assembly 2 and attach it to assemoly 3:

ERASE ATTACHES, XOR ASSEMBLY! EQV ASSEMBLY2; MAKE ATTACHED XOR ASSEMBLY1 EQV ASSEMBLY3;

The motivation for using an associative store is a flexible search and retrieval mechanism. Binding Booleans and Foreach statements are two methods of accomplishing these goals*

The binding boolean expression searches the associative store fcr a specified triple and returns TRUE if the triple is found and FAL-L otherwise. The aim of the search is to find an association which meets the constraints imposed by the specified triple. If seme of the components of the triple are unknown (such components are preceded ty the special item BIND), then a successful search will result in the binding of the designated component. For example:

IF FASTEN XOfc BIND OBJECT E&V PLIER THEN PUT OBJECT IN PL1EK!SET;

In this case by a PLIER PLIER!SET. assoc i ati on • bound.

the store is searched for an object that can be fasteneo and if such an object is found, it is placed in the stt

Note the use of the item variable OBJECT in the A successful search will result in this variable beinj

The FOREACH statement is the heart of LEAP. It is similar to the FOR statement of Ai_G0L in that the body of the statement is executed once for each binding of the control variable. For example:

FOREACH X | PART XOR B747 E8V X DO PUT X IN B747!0RDER!SET;

AND DATUM(X) < 3

In this case, assuming that the datum associated quantity at hand, the associative store is se B747 of which there are less than three on placed in

which "there are less the set S747!0RDER!SET.

with each part denotes searched for all parts of a

hand* These parts are

2.3. 5at3 Management f_a.c.iiiiy

Unlike other artificial intelligence languages, SAIL has the capability of being used with an existing data base management system (DBMS-10 iDECJ) to handle large data bases stored on external storage. An interface exists CSamet76J which allows SAIL to be used as the oata manipulation language in a CODASYL based data base management system. SAIL is relatively unique in this respect in that COBOL CC0B0L74D has

•wiaft*

Page 9: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

"

almost been exclusively used as the data manipulation languaae (DKL) of such systems. This situation is not surprising since examination of the aata description facility of the CCDASYL report reveals a very stron, similarity to the data division of COBOL* Nevertheless, there have oeen some attempts to use FORTRAN (CStacey74D, [RAPIDATA2).

fed pas of thi to r eq col cap set ace

C ur dec the Tan typ v ia «hi c an bee m or cer thi D ro

I tur sin

Bo s t avo ues lee abi

JN ess

S ren isi

u age e

a le al

ome e t toi s i hib

dea es.

ole ask ic t s t io lit ION i ng

U Ur ay nan an r is r

curre (the

ns of y for

and e xte

AIL h tly, ons * ser men t f rom GET),

ob ta lOC at s ra ban t n re s t ne i ti ve

as th SA

to

the he

ini e t the wo cor

st

a d st, ic equ ath

K set nde

a m is IL

bu tern

da ha

ng emp r i ns d rat

ata a f

stcr ests ere

pro ackt inte i lai

INT a st

echa onl

al so ilo . »h ta D s no ano

or»r unwi tanc type eg/

ma mp ull p age a shou

umber ol ems racki rs to ng an tRSEC orage

ni sin» y wo has an i

en eve öS e ( conv ther y sto «lay, es of s ca that

ulat roce Hoc Id n some rai

ng rel in-

TION mor

LEA rks a re n-co r th i.e. enie ins

rage es

a r n b i s g

i on dure at io ot b as

sed prob atea core can

e th

P. f for coru re a e us , he nt M tanc for

pec i ecor e re ene r

langu capa

n, an e dif point by pa lern reco data be p

an on

ace si cl i it:

folionin., y which allows parameter

o recursion. Second» processing ficult. In a CCBOL-oasea systex ed out by CParsons7Aj. In order rtial satisfaction of Boolean CTaylor76D), the user must build rds. Third, there should be a base so that operations such 0s

erformec without the overheao of ce for any record.

or bui Id internal st ru ctu

ata base er obtai locates

ay of ke e of thi the var

ally wh d type, fetched ally fol

ing as memor

re cap . In ns an it vi

eping s reco i ous en he Alter

from t lo.ee.

socia y due aoi I i a COE insta a a f it in rd ty field wi she na t i v he da

How

11 ve to i

ty w OL-ba nee IND a temp

pe. s; h s to e ly, t a ba ever f

aata mp lern hich sed d of a no f e orary Of co owe ve keep insta se . the

oas ent at enao

ata b rec

tcnes mem

urse, r» I track nces In fa cost

es • ion les ase oro it

or/ r.e

his cf cf

ct, i s

orietly, the SAIL interface provides a SAIL recora structure declaration for each record type that has been defines in the data La^e management system. Primitives exist for the creation ana modification of such records. The dynamic storage allocation capability of SAIL enables the creation of several instances of each recora type each of which is identified b> an entity known as a recora pointer.

länaj i s t e xt ra which is i EwtCT s t rue [ = eec f unct s true NEXT the a poi aoded

Asa emen o t ct a

i s aent RICA t uri h7G3 ion t ure wh ic LIST nt er

to

n examp I t system raver se n inte^e ä member ified b L for ng f aci st ructu to add LISTX h

l) is of x data s to t he

th i s i ns

e of , co

a r Q3

of

the li ty re)

it aS t type t rue head tanc

the ns ide se t n ta it the s he o data

(kn we de ems wo fi

RECO ture) of a

e.

use of • r the ' i amed •••' .' em krv.. .*. et. tue wner re

item own as fine a d to the elds - t RD'POINT . The f n i nstan

MJL a 11 >*1 P' I ER

ar P er. ac

crrd*. I 11> US

a RE ata s front LEMEN ER (a uncti ce of

s a ng ow

ART t i

w TRY COR tru of

T w nd on

hos prog ned NUM nsta AREH

D!CL c tur a L

hich pcin ADDT STX

t lang ram fr oy a w f rom

nee of OUSE, Since ASS an e know ISTX s i s of

ts to CLIST and t

uage agme AREh eac the hav SAI

d si n as t rue typ

anot has he

1 n nt . OUSc h P set

ing L h mi la

LI ture e I her t.o inte

a d T

re ART oc th

as r t STX

NTF ins arg ger

ata he cor

r cur e a

o a a

The GER tan ume

t

base t ask

d ana ecoro re nee va lue data PL/1

na a cata ana

ce of nts - o Le

RtCOROfCLASS LiSTX(INTCGER ELEMENT; RECCRi '.POINTER (LISTX) NEXT);

PKOCEDURE A&DTOLISTCtF. •'->;. «1.6 R ECORD !POINT ER (L I STX ) HEAD; »frTYfc-.Ä VAL);

BEGIN RECORDfPOINTER UIS1*', TEMP; TEMP := NEW ! ELEKf.NT tLI S fX); LISTX :ELEMENTCTEMP] := VAL; LISTX :NLXTCTEMP3 := HEAD; HEAD := TEMP; END;

The COEOL/DML ana SAIL encodings are given below The critical

rc- ^fljbdfc^i ». i A i

Page 10: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

.1,11.. ..„.I III „I II Ul„l,

difference is the step "Add PARTNUM in PART to result immediately obvious how the concept of a list would be COBOL.

list." It is not implemented in

COBOL Pro-ram: MOVE

NLXT:

ALL!F0UND

IN WAREHOUSE. ELECTRICAL' TO INDUSTRY FIND WAREHOUSE. RECORD. IF SUPPLIER SET EMPTY 60 TO NONE!SUPPLIED . FIND NEXT PART RECORD OF SUPPLIER SET. IF ERROR-STATUS = 0307 60 TO ALL!F0UND. 6ET PART. Aud PARTNUM in PART to result list. 60 TO NEXT.

SAIL Program INDUSTRY := "ELECTRICAL"; FIND!CALC(WARcHOUSE); IF EMPTY!SET<SUPPLIER) 60 TO NONE!SUPPLIED; WHILE TRUE DO BEGIN

FIND'NEXT(PART,SUPPLIER); IF ERROR'STATUS = 0307 THEN DONE; 6ET(PART); ADDTOLI ST(HEAD,PARTNUM); END;

2.4. Csoirgi S.$ryc£yres.

In aodition to the ususal control structures associated with ALSGL-like languages (e.g., FOR loops, WHILE loops, case statements, recursive procedures, etc.), SAIL has capabilities to enable parallel processing, backtracking, and coroutines. In SAIL, a process is ° procedure that may oe run indepenoently of the main procedure. Thus several processes may ue run concurrently. Note that the main procedure is also a process.

A process is created with a SPROUT statement as follows:

f.PRGUT(<item>,<procedure call>,<options>)

where <item> names the process for future reference, <procedure call> indicates what the process is to do, and <options> is used to specify attributes of the SPROUTed and current process. Unless otherwise stipulated (in <options>), a SPROUTed process begins to run as soon «s it is SPROUTed and in parallel with the SPROUTing process.

Similarly, there exist primitives which result in the suspension of a process, the resumption of a process, and in the blocking of a process until a number of other processes have terminated. These tasks are accomplished by the SUSPEND, RESUME, and JOIN primitives respect ively.

SUSPEND and RESUME have as their arguments single items while JOIN has a set of items as its argument. These items are the names that have been set up for the process by an appropriate SPROUT command.

For follows:

example, a procedure to tighten a bolt may be defined as

ITEM P1,P2;

SPROUT(Pi ,6RASP(HAND1,SCREWDRIVER));

--"- •

Page 11: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

*"•"- I II» ^^^^^mmmmmmmm

SPROUT(P2 »GRASP (HANDe.BOLT));

J0INKP1, P2>); TURN(HAND 1 , CLOCKW1SE);

Since SAIL runs on a single processor computer system, true multiprocessing is not possible. Instead, the SAIL runtime system contains a scheduler »hich decides which process is to run and for he» long. The programmer makes use of the <options> field of the bPRCoT statement to specif/ information which the scheduler uses to determine the next process to be run. Such information includes time quantum sizes, priority, whether or not to immediately run the SPROUTec process, etc.

A process may result in the binding of ITLI*VARs by use of <- MATCHING PROCEDURE, which is basically a Boolean procedure. When one of the parameters is an unbound FOREACh itemvar, then upon success the parameter will be bound . The matching procedure is actually SPROUTtc as a coroutine process and SUCCEED and FAIL are variants of RESUME which return values of TRUE or FALSE respectively. In addition, FAIL causes the process to terminate whereas when the matching procedure is callea by the surrounding FOREACH via backup» then the orocedure is resumed where it left off on the last SUCCtED.

For example, consider a box fasteners (nails, regular screws, is to obtain Phillips screws. This can be achieved by the YATCHINo PROCEDURE which returns a different Phillips screw it is invoked.

cont ain i ng bolts» nut s

number of cks, et c .)

different The g oaI

following each t ime

Note th bound.

MATCHING PROCEDURE GET'FASTENER (7ITEMVAR FASTENER , F ! TYPE); BEGIN

FOREACH FASTENER | FASTENER IN bOX AND TYPE XOR FASTENER EQV F!TYPE

DO SUCCEED; FAIL; E^D;

it FASTENER is a FOREACH ITEMVAR which upon success will ue

backtracking is supported by variaDles of type CONTEXT. However, the programmer must specify the points to which backup is to occur (for example» recall SUCCEED). State saving and restoring is achieved ty use of CONTEXT variables which act as pointers to storage areas uf undefined capacity in which are stored the entities to be saved and restored. Actual state saving ana restoring is accomplished by use of the primitives REMEMBER and RESTORE.

Processes mat communicate with each other by use of the SAIL event mechanism. This is a message processing system which enables the programmer to classify the messages and to wait for certain events to occur. Events occur via the CAUSE construct which has as its arguments the event type, the actual notice, and instructions with respect to the disposition of the event. Similarly, there is a construct known as INTERROGATE which specifies a set of event types and instructions with respect to the disposition of the event notice associated with the desijnatec event types* A variant of this facility has been usec extensively in the implementation of the Stanford Hand Eye Project [ Fe loman71 J .

:.—•— f-^:-

Page 12: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

wm—1"•," ""• 1^tIIH.»WUI.WIIWJIJJI'.l..l'l I I m«H*pimi' •

2.5 features which SAIL includes many features which are

building. Assembly language statements SAIL statements by use of the

A numoer of different files which are prograir can be specified via use of REQUIRE statements.

regula r construct s.

specif ied via

The statements:

designed to aid in system «ay oe interspersed with START'CODE and CUICK'CODE

to be used with the

RtQUIRE "TOOLS" LOAD!MODULE; REQUIRE "CAhLIBC1,3D" LIBRARY;

Mill cause SAIL to inform the loader that the file TOOLS.REL must c.e loadeo. In addition, the file CAMLIE on disk area C1»33 serves as a library and is searched for needed routines.

The statement:

REQUIRE "HEADER.SAI" SOURCE'FILE;

will cause the compiler to save the state and scan HEADER.SAI for program text, scanning of the original file resumes at a the REQUIRE statement. This feature dealing with libraries since in this case EXTERNAL aeclarations thereby freeing the such MOTK and possiole errors«

of the current input file, When HEADER.SAI is exhaust«!,, point immediately following

is particularly useful whei the REQUIREd file can contain application proorammer from

A rather extensive conditional compilation capability is associateo with SAIL. This enables the development of large programs which can be parameterized to suit a particular application without compiling unnecessary code and thereby wasting memory for progriir. segments which are never used. This capability is used to enahance 0 macro facility to include compile-time type determination; for loops, while statements! and case statements at compile-time; generation of unique symbols, ano recursive macros. For example:

DEFINE GRASP(SIZE) = CIFCR SIZE ;EC 1

ENDC3;

> 1 THENC VISE

results in the definition of a macro named 6RASP having one fornn.1 parameter. SIZE. The result is the name of a tool that is appropriate for the size of the item that is to be grasped - i.e., a vise in case size is greater than 1 (assuming size is measured in centimeters, etc.) and pliers otherwise. For example:

TC0L1 := oRASP(IO.O); TO0L2 := CiRASP(0.5);

will result in the following statements:

TOOL! :s VISE; T00L2 := PLIERS;

Note that the choice is made at compile-time and thus the programmer need not be concerned with the available yrasping mechanisms Thus the program compilation step can be used to aid in the writing of the program. The example illustrates the importance of such a feature when certain tasks can be achieved by similar, yet not identical, means.

SAIL also provides an excellent interface with the operating system. This enables its use for real-time applications such as control of external devices. In fact, interrupts can be handled ano the user has at his disposal all of the I/O capabilities that an assembly language programmer has. This enables the development of

»laü^Ai^hitttfiiMiMtaMnMM H*mami^mm*^*am<m*a*i*XM 1ilimi.ni »in 1 - v _JlllA±_

Page 13: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

r — •'•-•'•••' •'-•"• -••!.• •niiiiii mi i ^mmmmmmmmmmmmmm

programs ranging from scanners to mechanical arm controllers* addition to compatibility with assembly language fleouggers, SAIL has high-level breakpoint package known as bAlL CReiser7SJ.

In a

.6. S tandardiiaiian

under The re SAIL captur Partie develo mac hi n The la progra An ext struct data b YAINSA

urr bo

i s k no e u la p a e s. ngu IPS ens uri ase IL.

fcnt ly th th an ef wn a the r th UTÜ

age i will

ive r ng f

c apa

, S e T for s tea e uag e s c

ha un aci bil

AIL fcNtX t un MAIN ture ease e th orie onsi ve t

t im li ty ity

nas o CfaBN

derwa SAIL s th

of at is nt ati ce rat> o be e li

I of SA

nly EXEC y at Cwi

at inte cap

on ly d modi brar t i IL

been 3 an SUM

I cox make ract able of t iffe f ied y 1 5 .st c i »e

impl o TOP EX to 763.

SAI ion w of b

he pr rent in o

s be ill u ., L

emen S-1C de v Th

L a ith eing c je c thö rder ing nee r LAP)

ted on CTOPS

elop a e goa I n att the op run o

t is t n SAI to be provi tain w

will

the 103 Ian of

ract e rat n a owa r L a cap

ded neth

be

PDP- opera cuage that ive i ng s larg

ds mi nd e able as

er th inc

10. ting

s 1 proj la ng ystc e n ni -c xi s t of c is e as orpc

It sy s

ir i lo ect uage m) a urr.be ompu i ng ompi a r soci rate

runs terns, r to is to

(ir, nc to r of te rs.

SAIL I i na . ecoro at ive d in

t • - : r -rrg-s«»««, XJLJLZ^-.;..:-^..-.-. •...--- -• ^ah.-af --i. d^Mii';.

Page 14: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

lb* use ftaiiz si Lioausass

3.1

proce is an I ambd recur imp le compu resut FORTR chang gener origi

USE LISP < s s in _,

imp le a ca le s i ve ment at t ati on ted in AN as ed con at pu nal el

CMcCar langua men tat ulus . functi ions o al pa

a fir a pra

s id era rpose egance

thyb ye d ion McCa on t f L raui st v ctic Dlyt pro

03, C evelo of pa rthy* heory ISP »m ( er sio a I pr

so t ^r am»

Levin65 ped by rts of s inten as a t

relied i.e., n n of LI ogrammi hat tod ing la

John Alon t ion heor exc

o it SP ng t *y L ngua

We i ss McCa

zo Ch was

y of lusiv erati wh ich oo I . ISP i ge w

rran6 73 rthy a urcn's to re comput 11 v u on) , w

was Howeve sane hich n

, Csik t MIT work

cast at ion. pon r hich, not

r, LIS x t reme everth

lossy76D), a I in the late 5C CChurch41] in the e legar. •

Thus, t h T i ecur si on as although elega compet11 i ve w P's character ly powerful eles s retains

he most interesting features of LISP «re

(1)

(2)

(3)

The language is practically devoid of syntax; all constructions in LISP fall into two categories: atoms and compositions of atoms.

data arc interchangeable, since they are in the same format. Therefore, in LISP it is one function to construct another function as execute it by indicating to the LISP system to

an existing function's jü or augmented by another

at run-time. In fact, a function if appropriate care is

is canable exerc ized .

Program .na repres ent ed possisle for data, then regard it as code; alternatively, code may be examined, modifie function at run-t" ' ** self-modi fication

Memory allocation ano management are. automatic and transparent to the user, except where the user explicitly desires to influence them, with the exception of ar-ays, there are no space declarations to be made, freeinc the programmer from the details of space allocation, ano §enerally allowing for the unlimited growth of any given ata structure. (For the most part, LISP data structures

have no size or complexity constraints.) Used memory which is no longer involved in the computation is recycled automatically by a garbage collector either on demand from the user at specified points or automatically.

ist 'i, the of

rs t the nt, ith has ano its

U> LISP i s a f uncti on with any a rgume nt LISP sy s tand-alo Typically speedup w languages i nterp ret DOS sio le i nte rpret p roduc tio

n in of

LliP to b stem ne ». c

hi ch , or ed to

er, n ap

te rpre one ar data

e reya s in machi n ompila make s even and c retai whil

pl icat

ted gume stru rded clud e c tion LIS

with ompi n t e ions

langu nt, ( cture as c

e a ode

p ro P com well

led he f obtai

ace . T EVAL X as it

oop an compi for

vides pet iti -coded code lex ibi niny

he ), s s a d ex ler int an

ve ass

may lity the

syst uch rgum ecut wh i

erpr ord with emb I be an

spe

em that ent ed. ch eted er

ot

r ia inte d p ed

proper calli cause

Howe ve will

f un of ma her c ngua ge rmi xed ower requir

is a ng EVAL s that r, most produc e eti ons . gni tuJe omp i led . Since , i t i s ef the eo for

(5) LISP remains recursive, while also accommodating iterative algorithms via a so-called PROG feature, both recursion and iterative programming are illustrated in subsequent sections.

(6) Because of the technique LISP uses in storing local and global variaoles, some very powerful context-switching can be carriea out, providing a fast way to enter and exit hypothetical planning environments and to cause the

L, ilüiiija ,„• .. •• • .,„. .-:•.. .^.., _—. mtmmm

Page 15: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

r T wxm "^"~

behavior of a program to vary environmental context«

as func t ion of its

3.1.1. WISE Dälä SiCy£iure

LISP's data structure! called the S-expression, is simple, yet extraordinarily f lexible, proviaing a substrate upcn which a programmer may aesi^n his own complex data structures. An S-expression is either an "atom" or a "CONS node". An atom can be regarded as either a variaoU, a constant Ca passive symbol), or both. There are no declarations in LISP; new atoms are simply admitted to the system «s they are scanneo at the input level, and atoms with the sane name are guaranteed by the system to be unique (i.e., they have the san.e internal pointer, or address).

The other type of S-expression, the CONS node, provides a means of structuring atoms and other CONS nodes into hierarchical data structures. A CONS node is ordinarily implemented as a single computer word (say, 36 bits long) which contains a left pointer, calleo its CAM« and a riant pointer, called its CDR. COKS nodes are created dynamically via the function (CON» X Y), where X ano V are any other S-expressiens, or passively (as aata constants) via the construction (X.Y). CCNS noaes can be composed to form arbitrarily complex hierarchies, the bottommost elements of which are usually atoms (i.e., pointers to atomic S-express ions) •

To illustrate, suppose we wish to represent a particular tool, Be) a screworiver, in a LISP data structure. We first decide upon a narre for it, say, SCREwDKIVER-1, and what characteristics of it we wish to encode. Let us suppose the characteristics are: type is Phillies, col«r is yellow, shaft length is 10 centimeters, and head size is 0.3 centimeter. There are many ways to encode this in LISP; the external representation of the one we adopt here is:

((NAME SCREWDRIVER-1) (TOOL-TYPE SCREWDRIVER) (STYLE PHILLIPS) (SHAFT-LENGTH 10 CM) (COLOR-CODING YELLOW) (HEAD-SIZE 0.3 CM))

Here, all symbols such as NAME, YELLOW, etc. are LISP atoms. (So too are the numoers; however numbers are not entirely equivalent with symbolic atoms.) The particular hierarchy we have adopted is a list of lists. where each sub-list consists of an initial atom describing that sup-list's role in the structure, and a list of the information associated with that role in the description*

This structure would be graphically represented as follows:

10

mhm —— •»1,'ii.inl

Page 16: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

"

4 4 1*1*1- 4— -4

4 4 ->l*l*l-

4- —4

• —-4

• 4 •>l*l*l-

•—-4

4 • •>l*l*l-

4- — *

4---4 >l*|/| 4---4

• 4 4 4 4 • 4 4 4- • 4 4 M*l->t*|/l l*l*l->l*l/l l*l*l->l*l/l • —-4 4 — 4 4- —4 4~ -4 4-—4 4~ -4

STYLE PHILLIPS NAME TOOL-TYPE

SCRENDRIVER-1 SCREWDRIVER

4 4 4 4 l*l*l->l*l/l 4---4 *---4

COLOR-COCI M YELLOW

I 4--- 4 4—-4 4—-4 4-~4 4- 4 4---4 |*|*|->M*|->|*|/| |*|*|->|«|*|->|»|/| 4 4 4 4 4 4 4 4 4 4 4 4

IHAFT-LENGTH 10 C CM I 0.3 MEAD-SIZE

I I CM

and could be constructed passively (as a fully constant structure) via a quoted S-exDression:

'((NAME !>CREWDRIVER-1) (TOOL-TYPE SCREWDRIVER) ...)

or dynamically via CONS :

(CONS (CON;, 'NAME (CONS 'SCREWDR1VER-1 NIL)) (CONS 'TOOL-TYPE (CONS 'SCREWDRIVER NIL))

(CONS 'HEAD-SIZE (CONS 0.1 (CONS 'CM NIL))) )

Since it would be a rather harrowing experience to construct very lar^e S^express ions dynamically in this fashion, LISP provides a spectrum of

acce s s in» higher-level functions for constructing, modiTying ana ac< S-express ions. Some highlights of these Mill be covered briefly in a subsequent section. For our example, a more concise expression of cooe which would build this structure dynamically would be:

(LIST (LIST 'NAME 'S CREWDR1VER-1 ) (LIST 'TOOL-TYPE 'SCREWDRIVER)

(LIST 'HEAD-SIZE 0.3 'CM)

Presumably, having defined this tool, we would want to record it as one available tool in a large supply of tools. Again» there would be numerous methods of doing this. One way would simply be to maintain a §lobal list of all known tools in the system, and to add this entire escription as a new tool on this list:

(SETQ NEW-TOOL '((NAME SCREWDRIVER-1> (TOOL-TYPE SCREWDRIVER) ...)) (SETO MASTER-TOOL-LIST (CONS NEW-TOOL MASTER-TOOL-LIST))

(SETQ is one of LISP'S assignment statements.) Alternatively, we might wish to put only the name of the screwdriver on the master tool list, and associate all the remaining information with property DESCRIPTION on SCREWDRIVER-1's k£BB££lX lilt*

11

tfto^i^tit^Mi _ - —

Page 17: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

ltm •!«»«. III! I . *-mw~*-mm-»-•-« 11 | ,

3.1

(PUT 'SCREwDRIVER-1 'DESCRIPTION '((TOOL-TYPE SCREWDRIVER) ... (HEAD-SI

(SETQ MASTtR-TOOL-LIST (CONS 'SCREWDRIVER-1

Ers£££i^ kisis

ZE G.3 CM>>> MASTER-TOOL-LIST))

Any LISP aton« may have a property list (built up *roir CONS nodes). Conceptua 11y« the property list allows the attachment of an aroitrary number of attribute-value pairs to the atom, thereby serving to describe the characteristics of the real-world entity represented Ly the atom. This is a powerful feature for any programming language, since it allows "micro-oescriptions" of atoms which ordinarily Mill net be seer by the processes that manipulate the hierarchical structures in which the atom participates. These microdescriptiens can be maintained and accessed by the functions PUT i GET and REKPRüP in case more aetail about an atom is aesired.

Properties are attached to an atom via the function (PUT <atcm> <öttributfc> <value>), looked up via (GET <atom> <at t ri but e>) , ar.j. removed via (REMPKOP <atom> <attribute>)• We have seen one way to associate the screworiver information with the atom SCREWORIVEP-1 usin^ property lists. Another, more convenient way would be to split apart all the various attributes of this atom, making each a different entry on the property list:

(PoT (PuT • • • (PuT

'SCREwDRI VER-1 'TOOL-TYPE 'SCREWDRIVER) 'SCREwDRI VER-1 'STYLE 'PHILLIPS)

'SCREWDRIVER-1 'HEAD-SIZE '(C.T CM))

To determine SCRfcWDRIVER-1's heaa size, we would then «rite: (CtT 'SCREWDKIVER-1 'KEAD-SIZC). If such an attribute of SCREWDR1VER-1 exists, it will be located and returned.

3.1.3. E§B££S£DlätiSit kliE ßälä Struc.J.y££ *4DiByt4tiDa EUQttiOQS. we include here a definition and brief example of several of the

more stanoard, hiyh-level LISP functions that pertain to data structure creation, mootficotion and searching.

3.1.3.1 . (ö£3w.w.R I 11

If S-expression X is a member of S-expression Y (assumed to be a list), return "TRUE", otherwise, return "FALSE".

EXAMPLE: (MEMBER 'SCREWDRIVER-1 MASTER-TOOL-LIST) returns a pointer to the atom T ("true") if SCREWDR1VER-1 is on the MSTeR-TCOL-LIST, and a pointer to the atom ML ("false") otherwise •

12

Mw^MMMiMttMMtaiiiiteMMMiaMiMlWMiiiriliiMattM «•MT

Page 18: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

r .1.11'WIIUIW«. •• •'••«. iJI"»»w

iÄSSQt £ 12 ^.1 .3.2 Y is a list of lists. Y is scanned» comparing the first item of

each sub list to X until a match is found, or until Y is exhausted. In case a match is founo« ASSOC returns the entire sublist whose first item matched X.

EXAMPLE: (ASSOC 'HE«D-SIZE '((NAME SCRE WDR IVER-1 ) ... CM))) woulc return the sublist (HEAD-SIZE 0.2

(HEAD-SIZE C. CM).

3.1.3.3. (§yasi X Y Z)

are arbitrary S-expressions. SUfaST creates a occurrences of Y in Z are replaced with X s.

new cot./ X» Y and Z of Zf whe re all

EXAMPLE: (SUBST 0.2 3.3 '((NAME SCREWDRIVtR-1) ... (hEAD-SIZt C.2 CM))) would produce a new structure for our screwdriver, identical in all respects to the original, except that its head width would be 0.2 instead of 3.3.

3.1.3.A. ueeEMp, i n X anc Y a re

appending Y onto lists. A new the end of X

list is created which is the result of

EXAMPLE: (APPEND '((NAME SCREWDRIVER-1) (STYLE PHILLIPS)) '((COLOR-CODE YELLOW) (HEAD-SIZE 0.3 CM))) would produce ((NAME SCREWDRI VER-1) (STYLE PHILLIPS) (COLOR-CODE YELLOW) (HEAD-SUE Li.3 CM))

3.1.4. LISP »aia Ixess In addition to atoms and CONS nodes, most LISP systems include the

following other data types:

1. integer numbers 2. real numbers 3. strinjs A. arrays 5. octal nuiDDers (for bit-level manipulations)

Some versions of LISP _.-. (notably MACLISP EMoon743) have highly developed numerical and trigonometric facilities and compilers geared to the efficient software.

generation accompanying of "number

OptImi zin* crunch in^"

3.1.5. LISP. £UQ£lifiCl

A LISP "program" is a collection of functions. No function is syntactically declared as the "main program". Functions are generally typeless (i.e., no distinction such as "integer", "real", "string", etc. is made). However, each function may be declared so that its calling arguments are passed to it either evaluateo (as in most programming languages), or unevaluated. Except for this, distinction, there is no need for function-related declarations.

13

-

V>v.

Page 19: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

, , i wm^m^ "1 »"

A function is regarded as simply another function by assigning

eakin one typically defines a as the atom s value« nameless, and is identified by

Strictl if. spt form :

9.

type of data. As such, to some atom the function the function itself is

(LAMBDA <argument-list> <body>)

When e "lambda expression" is stored as the value of an atom* we say that a function has oeen defined. Although the implementation details governing how a lambda expression comes to be associated with an atcm vary considerably« one common format for defining a function in LISP i s :

(DtFoN <name> <arguments> <body>)

DEFUN assign: annihiI at ed

is o macro which creates the appropriate lambda expression ana is it to the atom <name> as the function's body. A function may De

or alterea simply by reassigning the value of the atom which represents it. Another virtue of this separability of a function from its name is that nameless functions can oe created and passed «. s arguments to other functions without having to DOther to name them if they are needed only once.

To illustrate LISP functions, let us define a function of t.o arguments» (LOCATE-ALL <tool-type> <tool-l ist>), which, given the name of a tool type (e.g.» SCREWDRIVER)» and a master tool list» will search the tool list for tools of the specified ty^e and report back a list of all tools of that type it finds. Framing this as a recursive function» we write:

(DEFUN LOCATE-ALL (TYPE MASTER-LIST) (COND ((NULL MASTER-LIST) ML)

((EQUAL (GET (CAR MASTER-LIST) (CONS (CAR MASTER-LIST)

(LOCATE-ALL TrPE (CDR MASTER-LIST)))) (T (i_OCATE-ALL TYPE (CDR MASTER-LIST))).))

'TOOL-TYPE) TYPE)

that is« if (COND) the master list is (or has been reduced to) NIL» then report back "nothing"; otherwise* if the next item on the master list (its CAR) is of the correct type (as determined by the GET), then add this tool to the list to be reported (i.e.» CONS it onto the front of this list) and proceed with the search on the remainder of the list (its COR); otherwise (T...)» simply proceed, without recording the current tool.

v ia A Ite rnati vely» we

the PKOG feature: could express this algorithm in iterative form

(DEFUN LOCATE-ALL (TYPE MASTER-LIST) (PROG (RESUuT)

LOOP (COND ((NULL MASTER-LIST) (RETURN ((EQUAL (GET (CAR MASTER-LIST* 'TOOL-TYPE) TYPE)

(SETQ RESULT (CONS (CAR MASTER-LIST) RESULT)))) (SfcTi MASTER-LIST (CDR MASTER-LIST)) (GO LOOP)))

vESy^T)

i.e.» enter a PROG (akin to an ALGOL begin-end block)» defining one temporary local variable, RESULT; then» while the master-list remains non-nil» repeatedly examine its next item, collecting those with the correct type on the RESULT list (via SETQ, LISP's "assignment statement"), scanning to the ntxt tool on the master list (SETQ MASTER-LIST (CDR MASTER-LIST)).

14

•jklfflMtitaMBmtfkMiiiäM mmi^m ».«*•••

Page 20: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

'• '• ' • • "mr~"***mm • ' •••-« UM i in um i i •••i mi mmm

3.1.6. The. PgOG Ffiityrfc

As just illustrated. LISP accommodates i terat ive ly-ph ra sto algorithms via a construction called a "PROG". A PROG has the form:

(PR06 <local-variables> <statement-1> ... <statement-n>)

As a PROG is entereu, the local variables the scope of the PROG* and each is statements which comprise the PROb's bod)

•falls

(if any) a ini tialized

are off

are allocates for to MIL. Next» the

sequentially executeo the bottom" of the PROG

a GO or RETURN is interpreted as labels

execution. When a öO occurs, and sequential

(evaluated) until execution either (an implicit exit from the PROG)* or until encountered. Statements which are atoms are within a PROG, ana are ignored during sequential is encounteredf a branch to the specified laoel execution proceeds from that point.

Since a PROG introduces some temporary variables which must te reclaimed as the PROG is exited, there must be some way of informing LISP that a PROG is aoout to be exited. The function RETURN is used for this purpose» informing the system that a PROG is being exited» and specifying what value the PROG is to return to the calling environment.

PROG program. effici ent recurs i ve '"impure",

ippear at any will typi caI ly apt point

resu It in

in LHP more

s may be nested and may The PROG construction implementation of an algorithm than implementation. Although some feel that PROG makes it is in reality the feature which is probably most

responsible for LlSP's present widespread acceptance in both the AI community and elsewhere.

the correspondinj LISP

3.1.7. USE 32££fiS

compi more resul f inal inter inter f unct recog form power

be co given LNorm whi ch <char any scann possi poi nt del im

Most le-t

tha t , b

r pret medi i ons ni ze

whi ful

Most ndit

ch an69 con

> is comp er's ble whe

iter

LIS ime n n a ut an esult er, a ate f

ar s» mac ch i imple

LISP ioned aract 3, th ui tio dete utati inpu to

re LI s, et

P acr fu

oth

'is orm e ros t men

sc to

er ere ns cte on» t s sup SP c.)

i m v I e m os and nction er S-e Thus»

!*».• compi and e

then tati on

anne rs ini t i in t exi i.t the sc o in t

ana tream, erimpo can mo . MLI

entations scanner m<* which» w

xpression w when a

valuation i second to r led into valuates th compiles• of the mac

support two types of macros: cros. A compile-time macro is nothing hen evaluated. computes not a final hich» when evaluated» will compute a macro is encountered by the LISP s performed (the first to compute the un the intermediate form), when Lü>F actual machine code» the compiler em once to obtain the intermediate This technique is a very general and

ro concept.

are ate a he i s a f anner he in what This

se a del a SP CS

qui t n ar nput aci I to

put ever sty

ddit not h mith

e modul bi trary stream

ity cat call <f stream. <funct

le of ional s er Ian 703 is

ar» in comput

• Fore led (RE unc tion <funct

ion> re table-d yntax o guage's an exam

the sen ation u xamp le» AD*AC < > (no a ion> is turns i riven n LISP

synta Pie of

se t pon

in char rgum rre

s sp scan inpu x ( this

hat enco Wise > <f ents e t lice ner

by

they unter onsin uncti ) whe o pe d int

make vert t redef

can ing a LISP

on>) » never rf orm o the s it o the ining

3.1.8. yariaBie $c.gßind

LISP variable values are derived as a function of the run-time environment rather than as a function of lexical environment. As a program executes» there are two times at which new variables are introduced» or "bound": (1) at function entry time (these are the names of the function s arguments that are mentioned in the LAMBDA

15

tm ••«-'-•• — tfk^&al

Page 21: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

expression), and (2) at PROG entry tine (i.e.« the PROG s temporary variables). Variables are "unbound" at the corresponding exit times: when a function returns or when a PROG is exited.

e xe "9 I e xe int cal r ec use lis mai bou dyn at (on at far int

At cut i ng obal" cut ion roJuce IS. Al ordeo r-a c ce t, .tr nta ine nd (i ami c c the ti es wh run-ti ther o", or

the )» to

t t Q VI I th on

ss ib om m cat •?•! alii me f ich me w

bor

"to any

the here a LA e se

a le I ost

run ar

ng e a net

hav h ich the rows

p-le var

Wl MBDA vari stru ist rece -tim e o nvir ions e no

is call

the

vel" iable stem. II b or P

ables ct ure of CO nt to e, th n th onmen

were b ind

depen ing h vari

of s w

Th e a ROG

and ca

NS n lea

e qu e A t, r

def ing dent iera able

LIS hich eref

po on the

lleo odes st r esti -LIS athe ined at t

up rchy s of

P (w rec

ore« ol of the

ir as the

. All ecent on of T) i r tha . Thi he cu on t . In anot

hen eive at gl o cur

soc i "a

va r . Si wh a

s e n th s me rren hei r this her .

no val

any bal a rent ate a ssoci iable nee t t var xc lus e lex ans t lev

def mann

f unc ue s g iv

t oms seq

va lu at io loo

his iabl i vel i cal that el) i ni t er,

t i on are

en m p lus

uence es <" n lis kups list es ar y det scop "fr

will ions one f

is c thoug

oment all t of

bindin t" (A- consu

is dyn e and ermine e of v ee" v a ssume

in f unc t io

urr e ht o

ou he a f unc gs") LIST It ami c are d oy aria ari a

a v unc t n "p

nt ly f eS ring t oms t icn

are >, * this ally

net the

b Us o U s a I UP i ons eexs

oy changing the system's A-LIST pointer while inside a function, that function's entire environment can be altered. For this reason, LISP is a very powerful tool wherever hypothetical reasoning (involving switches to altered contexts) is necessary, "ost other languages either lack such an ability, or make it difficult to carry out. In LISF, context switching and "taking snapshots" of contexts to which execution

to bt returned are very natural i s operations.

3.1 .9. L.JS.P I/O

Traditionally, input/output has been LISP's systems define at least the following I/O-related

weakest link. Host funct ions:

(READ) read an S-expression (READCH) read an individual character (PRINT X) print S-expression X, skipping to a new line (PRIN1 X) print S-expression X on the current output line (TERPRI) skip to beginning of new line on output

While these functions provide adequate formatting control, most LlSFs are deficient in file-handlina operations. (INTERLISP CTeite lman743 is the exception, with more highly developed interfaces to the TENEX virtual operating system). We regard this deficiency as more of a historical accident than as an inherent problem of LISP (since adding these features is simply a matter of writing the code). In fact, there are efforts underway for improved multiple-file interaction and rancom access facilities both at f* IT (MACLISP) ana at Warylana (Wisconsin LISP).

3.1.10. Garfeaafi £sll«UlfiQ

Since LISP data structures can i,row in unrestricted ways, a crucial part of any LISP system is a conceptually asynchronous process called the "garbage collector". The role of this process is periodically to take control, mark parts of storage that art still referenced by the ongoing computation, then reclaim all storage that is not so referenced (garbage). Garbage collection is an unavoidable overhead of any system with no declarations, and in which oat« structures can grow in unrestricted ways.

one potential system runs out of

disadvantage of free storage,

garbage collection is that, once the a garbage collection »yst occur.

16

^v*-.^^.

Page 22: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

Since a garbage collect causes current computing activity tc te suspended! if LISP is controlling a real-time process* disastrous consequencs can accrue* Such problems can normally be avoided t>y forcing the system into a premature garbage collect prior to entering real-time critical sections of computation. Alternatively* there is growing interest in truly asynchronous (parallel) garbage collection techniques which could obviate the problem altogether (see CDi j kst ra7i, 3 for instance)*

3.1.11. LXiE as a Se^frtfiQlaingd. S.y.üe.m.

LISP After this software can

interpreters are typically implemented in assembly language. facility has been brought up* most other supporting

LISP itself. Typical software includes basic be written in

(1)

(Z)

A £fimE "> i£ £ which will generate (potentially quite gooo) machine code for LAMBDA expressions (i.e.* functions) and PkOGs. Typically* the LISP compiler will be written in interpreted LISP* then used to compile itself. The compiled version is subsequently used as the LISP system compiler.

A debug i nteracTi (toyet her entry ti return ti of varia variab le' potent ial system i (in part languages complex s i nteracti be conte produc tio

ya ck we ~3e with

me* a me. Mo bles s va lu s of L s the ) for

for oftwar on wit nded w n wi th

age veto thei nd st L (i.e eis ISP

mos LI

the e. I h sy ith; in t

whi pmen r ca (tog ISPs ••. abo

are t ad SP s

ef n pa stem

ua p he c

ch will t of fun I liny ar ether wi wi11 al inform ut to b essentia vanced t

reputa ficient rti cular compi le

ro on aa» c t ines

ctio gume th t so a the e c Uy o da t ion and

. th

an b of t

rmi t ns. T nts) hei r ccomm user

hange unl im te),

as rap

ere i loade e dev he LI

the ypic can retu odat

wh d). ited and one

id s no rs a e lop SP s

trac ally, be t rned v e the enever The (the

a re re of

develo time-

nd li ed and ystem

ing func t raced alues

tra at?

debug INTER spons the pment consu nker s put itsel

and ions

at ) at 'ing ac ;d ging LISP ible best

of ming

to into f .

(3) An S-expression editor (or system editor makes possible tfie'cönvenient editing of maintenance of files*

interfa ce) which S-expressions and

3.2. 21£Kfi£L.ASNE.a

while LISP is generally accepted as the standard for computing in AI* it ooes not supply the user with any a-priori conceptions aoout intelligence. LISP is simply the blank tablet onto which the user must write his theory of intelligence or control. Not surprisingly* this resulted in numerous reinventions of the wheel in areas like database organization, problem solving* hypothetical reasoning* and language understanding. Most reinventions were at a fairly low level* but occurred often enough to warrant some investigations into some of the undercurrents of AI programming techniques.

MICROPLANNER [Sussman, winograd* Charniak 713 is the outcropping of some of these undercurrents* particularly where automatic problem solving is concerned. MICROPLANNER was written in 1970-71 as a small-scale implementation of ideas originally proposed by Hewitt in 1969 CHewitt693. The intent of the language was and is to provide some automatic mechanisms of database organization, context, and heuristic search •

MICROPLANNER is syntax is essentially envi ronment , MICROPLANNER

the user (he reafter

implemented entirely LlSP's syntax, and

"••» full acc~ abbreviated

in LISP. Because of this, its - while in the MICROPLANNER

has full access to all of LISP* To distinguish MP) functions from pure LISP

17

wmmm -— -

Page 23: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

T ^mmmmmmmmm

functions» the convention about 50 of them) with "TH" notion in MP).

is to prefix all Mp functions (there art (standing, we presume, for "theorem", a kty

The most salient features of MP are these

(1)

(Z)

(3)

Comput c cl I in c omput whenev goa I normal expert Whenev dot aba pat ter t ried This i stands vtry ii e xpert in the

ati 9 . ati er i s ly s w er se ns in s a ro odu s po

on l fun

on ( a go pos mea

ith a n

of e mat

turn rod par lar by pula

n MP ct ion often a I re ted ns a ^atte eed i xpert ch t unti

icaU ad igm syste name; ti on

i s l s b ca I

qui r to

la r ns s po s I he I on y di

of m wh pro

at I

nduc y t led es s the rce wh i c sted ook i neeo e su ffer "na

ere blem arge

ed by hei r "pat

oluti enti popu

h adv , the ng f • Ea cceed ent c me ca the r s a re

pa nam

tern on, re lat i ert i

sy s or ch e s, o omp u Hin eque

sol

t tern es. -d i re a pat syste on o se ea tern s those xpe rt r unt ting *", s stor ved b

* r In cted tern m • f ch o ea re

wh so

i I a para i nee

nee y an

a t her this

i nv de sc

"Enti p robl ne 's hes t ose I ocat U ha di qm it JI

dn't ony mo

th sty

ocat r it i re s e m-s e xpe hrou adve ed i ve f fro

a ke s kno

us e

an uy le of ion"), ng the ystem" oIving rt i se • gh the rt i sed s then a ilea . m the

f or a w any xpert s

Mr automatically maintains a context-sensitive database of both factual assertions and the experts just mentioned. Trie factual database is a collection o.f highly indexed n-tuples. expressed as LI3P S-expressions. Any one n-tuple ("assertion"), or collection of n*tuples can oe "associatively" accessed by presenting the lookup routines with a pattern containing zero or more variables. Only those facts that are deemed active in the current "context", regardless of whether they physically exist in the memory, will be located.

MP o nono deci (tit heur rtf e "Lac disc alte back i n i t reco the not h main t ree sugg to s

oe s et erm si on he r a is t ic re nee kup" ards rnati up pr ia I rd of syst

ing h ta in, ) for es t uch a

all inis of a rbit s), , an to

the ve, oces (bad all

em ad e

at eac

late UtOR

the tic ny so ra ril reco

d the that

cur re and

s, a ) ch

c han pi cks ver v)

leas h pro r, th at ic

bookk prog ra rt in y» or rds t n proc

deci s nt (fa then

11 CO oi ce ges to

up one wr t imp I b lern i ere ar cont ro

eepina mming. MP, t

under t he alte eeds. I ion poi i I ing) attemo

mputati and the the da

from t ong. icltly, t attem e both I.

re Th

he he ma f a

ch ts ons fa

tab he Thu an

adv

qui r at i sys

cont t ive fai the

oice to

i lur ase dec

s» ent to

anta

eo for s, anyt tern ma rol of s for p lure e systern

, sele proceed rformed e point is ma i i s i on p KP can ire goa so I ve .

ges and

de i me kes user os si ver

aut cts

aga be

are ntai 0 i nt

be 1 tr

As dis

pth-f i t he re

a ch -spec i b le fu

cause omat i c

the in. In t ween

undon neo ) ,

as t»* •v a I d

ee < se we

advant

rst , is a oice f ied tur e s a ally nex t

the the

e (a and

to arch wil I age s

In the foilow in. These are the three main contributions of MP. in the following sections we highlight and illustrate some of the specific features of this problem solving language.

3.2.1. The MICRO PL ANNER Database

Conceptually, the MP database is divided into two segments: facts intothree

"consequent" theorems. and theorems. theorems are further classified into three categories: "antecedent" Theorems are

t heo rems, disc ussed

"erasing" theorems/' and in sect ion 3.2.2.

Both facts and theorems are entered into the database via the function THASSERT; an item is deleted from the database via the function THERASE. Facts are fully-constant LISP n-tuples. Thus, to represent our screwdriver in MP, we might augment the database as

18

- • — •• SMK

Page 24: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

— — • • --- • . iummmmmm^****

*olIOMS :

(THASSERT (TOOL-TYPE SCkEWDRIVER-1 SCREwORIVER)) (THASSERT (STYLE SCREWDR IVER-1 PHILLIPS))

(THASSERT (HEAD-SIZE SCREWDRIVER-1 0.3 CM))

Database THGOAL. Therefore, knowledge of SCREWDRIVER of the Torn:

lookups and fetches are accomplished via if at some point in a MP program*

1's head width, we could write a

the function we requi red a fetch pattern

(THbOAL (HEAD-SIZE SCREWDRI VER-1 (THV X) (THV Y)))

For our example, this would respond with "success" (i.e., a fact hhich Hatched this template was located in the database, and it would produce the side effects of binding the MP variables X and Y to 0.3 and cr, respectively» The THV form is used in MP to signal references to variaoles (all else is implicitly constant).

Ever whenever

also oein ohysica 11 changed t present , copy of t database: the fact' the fact was firigi

*S

y !*c a fac y. b y» o "pr

THAS he fa

it s log

( i .e Dili*

t and t t or th esent

ut mark esent". SERT Oo ct. THE

ca uses ica I co ., if t

THASSE

heorem eorem in th

pres ed as If th

es not RASE e

a fac ntext he fac RTed).

in the is THAS e datab ent. I log ical e tact hing, c xerts t to be marking t i s be

MP database has a context SERTeo, if such a fact is not ase, it is created and then m f the THASSERTed fact is ly QP.1 present| its logical s is already logically and ph ut reports a "failure" to sto opposite effects on facts logically masked, either by

t or by actually physically ing THERASEd at the level at

mark i al re

ar*ed pres

tatus ysi ca re a in

chang deiet whi ch

ns • acy

as ent

i s Uy ne » the ir.a ing it

Context markings allow KP to keep track of the history of the logical status of each fact and theorem. This enables the system to bdck up to prior context levels, thereby restoring the database to the c or resoonui ng prior state. Thuj». although there are mechanisms for makins permanent bataoase changes (e.g., after some segment of MP cooe is Cunfiuent that what it has done is absolutely correct), normally (except at the top level), THASSERT's and THERASE's are not permanent; instead, they normally exist only for the duration of some stretch cf planning or hypothetical reasoning.

3.2.2. tJlC.R.O.P.LA*b£E Ibegrerns

THANT rat he in in r espo fac tu THERA any that r espo capao pat te

All E. r th tern nds. al d SI KG fact thes nse i lit rns

rea so THERA on by al fo

A «t aba theo

ua I p e two to an >. A match

nine (i SINb,

name, rm, exc

THANTE se of a rent is att ern

c lass y parti

THCOM its in

n fac and T The t ept w

the ny pa

wh ich es o cu lar SE t vocat

t, a HCON hree ith orem tter ered

mat f t

req heor ion

11 c SE " typ

rega i s

n wh

ches heor uest em r patt

omput ati theorems es of th rd to th triggere ich mate the THER its inv

ems res ), they esponas ern.

on) in " whic eorem . e type d by t hes it ASEure oca tio pono repres to THG

MP h ar a re of

he T s in fro

n pa spon ent OAL

i s ca e cal

ind event HASSE vocat m the ttern t aneo a gen reque

r ried led by i st ing to wh

RTion ion pa data

. In t us ly e ral i sts wh

out patt

uisha ich e into tte rn base he se (not nte r r ose g

by ern ble ach the . A of

nse in

uct Ocl

Because of this last interaction between THGOAL s and THCONSE, a TH30AL can amount to considerably more than a simple database fetch. In MP, when a THGOAL is issued, the system first attempts to locate the desired goal directly as a fact in the database. If this fails, and the THGOAL request has indicated that it is permissible to do so, MP will begin searching for THCONSE theorems whose invocation patterns

19

•**• «^MAMMMMM ——.

Page 25: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

(THANTE <optional-name> <variables> <invocation-pattern> <bcey>)

(THERAS1N6 <optional-name> <variables> <invocation-pattern> <touy>)

(THCGNSfc <optional-name> <variat.les> <invocation-pattern> <Lody>)

4s a brief illustration of the uses of wish to implement the following three cap* a new screwdriver is oefined to the s/steir name to be added to the master tool list; ( deleted from the system, automatically rex tool list, and also remove all its ace whenever, during some assembly task, a T <some screw> <some threaded hole>) is annou for, and return the name of an appropri (basea on the screw's style and heao size), a MP THANTE theorem, cart (b) by a THERASIT. THC0NSE theorem as follows:

each of these, suppoie w« bilities in MP : (a) whenever , automatically cause its b) whenever a screwdriver is ove its name from the masttr ompanying information; (c) HGOAL of the form: (SCREw-lN ncea, automatically »earth ate screwdriver for the task

Task (a) will S theorem, and

be modeleo part (c) cy

(THAf.Tt (X) (TOOL-TYPE (THV X) SCREWDRIVER) (SETQ MASTEK-TOOL-LIST (CONS (THV X) /,ASTER-TOOL-LI S T) ) )

(THERASING (X) (TOOL-TYPE (THV X) SCREWDRIVER) (THPROG (ST CC ... HS HSU)

(SETQ «ASTER-TOOL-LIST (DELETE (THV X) MASTER-T00L-LI ST)) (THAND (THGOAL (STYLE (THV X) (THV ST)))

(THFKASE (STYLE (THV X) (THV ST)))) (THAND (ThGOAL (COLOfi-CGDt (THV X) (THV CO))

(TnEKASE (COLOR-CODE (THV X) (THV CO)))

(THAND (THGOAL (HEAD-SIZE (THV X) (THV HS) (THV HSU))) (ThERASE (HEAD-SIZE (THV X) (THV HS) (THV HSU))))))

(THCONSE (SCREW HOLE) (SCREW-IN (THV SCREW) (THV HOLE)) (ThPROG (ST HS HSU DRIVER DST DHS DHSU)

(ThGOA^ (STYLE (THV SCREW) (THV ST))) (ThGOAL (HEAD-ilZE (THV HOLE) (THV HS) (THV HSU))) (ThGOAL (TüOu-TYPE (THV DRIVER) SCREWDRIVER)) (THAND (THbOAL (STYLE (THV DRIVER) (THV DST)))

(EQUAL (THV DST) (ThV ST))) (TKAND (THGOAL (HEAD-SIZE (THV DRIVER) (THV DHS) (THV

(EQUAL (THV DHS) (THV HS))) (THRETURN (THV DRIVER))))

DHSU)) )

3.2.3« Ü£y.£i§Ü£ §.üi2ä£}££ 2l ItSüIIÜ 5kSii£äilSC it is possible, by including special indicators in THGOAL,

THASStRT and THERASt calls« to influence the order in which theorems are applied, or in fact to indicate whether or not they should be applied at all. Specifically, a THGOAL (similar remarks apply to THASStRT ana THERASL) with no. Indicators will fail unless the requestta

L 20

-'- •- - '-- ~- —' - - • -•*•"—-L>-——— _._^

Page 26: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

mmm mm mm—

goat be ap purpo a "fi by n t heor P rope has list the g to 1 creat setti more who f Ute will whi ch

can p t ie ses. Iter ame) ems rty the M1 11 tner nser e or ng st ru i n r ina

dis to

be sa a). ( ) If "or

those lists for» be a

al th t lim

modi in wh cture the

and cuss encod

t is f ied Thi s> is th ere

a speci hen c proper

) will o f a

pplieo eorem b iteo he fy anot ich a c d confi past ha rec omme

la ter. e heuri

excl the

is an fie " fi Ite ties be ca speci first ase a ur ist her N ol lee aurat s pro ndati

CON stic

usi v form ind

reco r is pass ndid fie (in

re a ic i P th tion i on ven ons NIVE know

ely we

i cat mmen inc the

ates reco ord

ttem nf lu eore of

on t to b are R pr leds

by aa nave

or pr dat io luded filt for

mmend er) b ptea. ences m, th theor he Da e the a ste ovide e.

t aba be

esen nil

in eri n appl atio ef or

Bot . Al e f ems sis

mo s pin s a

se fet en US t, it st" of a THGO ^ test icatio n list e any h form so, si ilter the use of pa t rel i the r

more f

ches ing has the

AL r (th

n. t al oth

s al nee fac

I ves st able ight lex i

(no for

e i the orems eques eorem If t I the er t low t one M ility can

expe r expe di re

ble e

theo ill

r th (r o

ca t, s he or em heor he P

pr evol ienc rt). et i o nvi r

tn

rents ustr e fo e f er n ly n po i ndi s on ems r ogr eore ovia ve i e ( Alt

n f a onme

will at ion rrr. of encta those ssess cater that fror,

ammt r m car. es a nt o a e.g.» hou>,n S at nt in

?.2.<». SfciE£biQ9 and 6ä£kyp. in ÜE

Search and baexup in HP can occur for two reasons: (1) sent THCONSE theorem which was run to accomplish a THGOAL fails, and another theorem must oe invokea (restoring the environment to the state at which the first theorem took over), or (2) some object to whicn the system has committee itself is oiscovered to be inappropriate, giving rise to the need of locating another candidate object and retrying. The THGOAL-THCONSE mechanism underlie the selection and backup where theorems are concerneo, but object selection is handled differently, via the THPROG MP construction.

In the previous THCONSE example, the goal was to locate some screwdriver which satisfied some set of features (in that case, the correct STYLE and HLAD-SIZE). This was accomplished by a THPROG which "conjectures" that such an object, say X, exists, then proceeds to determine whether or not this conjecture is true. In the example above, the THPROG searched for a screwdriver of type and size which matched the type ano size of the particular screw which was to be inserted* For the sake of illustration, suppose the screw was of type Phillips of head size 0.3. Then, the THPROG in the example above would have performed essentially the same starch as the followina, more specific, THPROG :

(THPROG (X) (THGOAL (TOOL-TYPE (THV X) SCREWDRIVER)) (THGOAL (STYLE (THV X) PHILLIPS)) (THGOAL (HEAD-SIZE (THV X) C.3)) (THRETURN (THV X)))

i.e., object an ooj this). object have unt il choose THGOAL keep object propay

i nt roduc bei no

ect whlc At tha

found. been sa some THS

anot he , or eve track o s remain ateo bee

e a se

h i t p Con tis OAL r n t f w

to aus

n init arch ed s of T uint, t inue fied fai Is

cand id wo, bu ha v ob

De te e of b

ially for.

OOL-T X wil with ( in (in

ate) . t not ject sted. ad ob

unc Fir

YPE I be this whi c wh i c

S all

ft i Thi

ject

ommitte st, out SCREWD tentat candid

h case, h case, i nee s three,

s curre s is th select

o v ain RIV ive ate th th

ome th

ntl e s ion

ariatle. X, to represent a candidate for X by find

ER (the first THGOAL 0 ly bouna to the first such until either all THGO

e candidate is a success), e system must

objects may e system must y considering,

back up pass the fi automati ca

and what ot Ource s

of backups which

the ing oes an

ALs or

and rst

her are

To keep track of theorem and maintains a decision tree, THTREE, every decision maoe, ano what to oo in failure. The strength of THTKEE is. of

from having to worry aoout failures programme r

object selection oackups, MP which is essentially a record of case the decision leads to a

of course, that it frees the if there is a solution,

21

aa» «UH Aitaiaiiili

Page 27: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

m

it Mil of THT on t h any ot i mposs subgoa is a depth- an ent correc part wholes occur. to do

I eventu REE is t e search her subg ible, Is canno I so qui first or i re b ran t. It * of the ale resy Unfortj

i n HP . C

all hat

(i oal to t c te gan ch oul tr

nth nat ONN

y be it

.e., s ca

fa ommj

awk i zat of T a be «i e sis ely, iVfcfi

found impose

one s n be a or i cat nicate -a rd ion of HTREE

more retai of la this has a

by a s an ubgoa ttack e co late

in i THTR tobe desi r nina rge p is, a bett

n exh often I mus ed). mp lex rally ts b EE. 0 undo

able the

arts gain, er co

austi unde

t be This ly i in t

ac kup ften, ne t w to be oart

of th very

nt rol

ve s sira sol V make nter he t

te one

hen abl

s w e TH dif str

ea re ble ed i sit twin ree . chn i

Sffio in f e to hich TREE f i cu uc t u

h. T dept n it

di ed

The que 11 f act dis are

do U, re l

he f h-f i s en f fie solu

M» Dec

a i I u most card

cor es if n n th

atal rst ti ret ult , t ions orga

ause re wi

of only

re c t, not ot im ese r

weo k orae y oe if

» s ni i a

of 11 c it the so

haue pos s espe

nes s r ing f ore

not i nee t ion

the a use

WaS to J

that to

ible c ts.

2.2.5. Qib^r £fiB re.s£Qt aiiye. JJP CäEäfeÜl £i £s

To complete Our description of MI C ROPLANNER, we include t«.o representatives of the other functions available in this lan^uagt» together with a brief example of each.

2.5.1. CTHFiND <moge> <variab±es> <£kel> <oodv.>)

the which sy stem essentially a THPROC

THFIND provides a way of finding all objects in satisfy a certain set of criteria. A THFINt is which is made to fail artificially after each successful location of an oDJect which satisfies the criteria. <mode> indicates how many oojects are to be locateo (e.g., "ALL'S "CAT-LEAST <count>>"....) ; <variables> serve the same role as THPROG variables; <skel> specifies what form to return as each object is found; <body> contains the THGOAL's, etc. which define the criteria. THFIND returns either a failure (in case <mode> number of objects could not be found), or a list of <skel>'s, each <skel> corresponding to one successful object thus found.

EXAMPLE (THFIND ALL (THGOAL (THGOAL

(X) (THV X) (TOOL-TYPE (THV X) SCFEWDRI VER ) ) (STYLE (THV X) PHILLIPS))

would return a list of all tools which were Phillips screwdrivers.

.2.5.2. ilöüESSAGE <variables> <eattern> <booy.>)

t ree) "hook such THKES THMES (its prov i check it w THMES c an t o oe

ASS t T S" w fai

SAGE SAGE <bod des i ng ill SAGE c orr

rea

ubuoa HMESS hich lures <pat

who y> wi

a w for t neve (in

ect t tt emp

Is AGE wil

P ter se 11 ay hem r son he ted

are st

I in ropa n>).

pat oe e

of bef

run; e MS prob

de see at erne te ree •jate

UDO te rn xecut äQli

ore na howe

y the lern a

nded nts

bac n b

mat ed). siea nd. ver.

THM nd t

int hav

ai lu k u eina ches

Thu

HD* if

ESSA hen

o (i.e . e no e res bene p to t

bac ked the THF

s, the possib

11 yoes someone GE is pr cause th

"on ffec ath he

up AIL THME le well gets epar e pa

the t. them TH*£

to patt SSA6 prop

oen int

ed rt o

way dow They ar in t he

SSAGE v by a

ern will E-THFAIL lems wit eath th o troubl for), t f the tr

n" t e ess goa I ia a

THFA take

com hout e TH e ben he 1 ee be

he g ent ia t ree

(THF 1L, cont

binat act ua MESSA eat h HMfcSS neat h

CJ I Uy

o s AIL any rcl ion U> GL, the AGE it

22

•iMiäMMii f-- lifcrähiVmSi

Page 28: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

• '• I

EXAMPLE: ... (anticipate difficult (THMESSACE (X Y.) (CTHV X) WILL

(THGOAL (LUBRICATE (THV X))) (THGOAL (SCREW-IN (THV X) (THV

a screw) IN

(attempt a Y)))) (retry)

y in insertin NOT TURN IN ( ?HV O)

remeoy)

(THFAIL

(attempt to insert some screw in some hole) (report a failure back up to the

THdESSAGE ((THV SCREw) WILL THHESSAGE)

. NOT TURN IN (THV HOLE)) )

would anticipate« detectt report» and correct a problem» then retry.

I an I an dev def Alt pat sop to the str par a sp

T gua $ua elo ic i hou ter his ma

n t ate tia ect

CONNIVER

he most aes was ge call pme nt enc ie s o gh the n-d irect ticated) i nt «i n 0 switch a ie s in 1 compu

of the

rec th

ed was f fi re ed » t num

am uni tat p ro

ent e re

CO P

P. a we

1 n«o he m e rou OHji son ions 0 lern

stage suit NNIVE ri nci s sug re ca tio GSt S S CO

them ra the

nee solv

in the of McDe R CMC pally gestea some n contr igni fie mputat i « work r than d not i ng has

ev rmot Derm •not i in t i mpr ol ( ant ons i ng one

be gon

ol ut i t's a ot t , va ted he ea oveffie e • c, • | featu ins or.

at a undo

e awr

en nd S

Su by

r li e nts the

re o täte it, any t ime ne y.

of th ussman s s m a n

the r disc

i n patte

f CUNN s of s

subq .Ins simply

e LI 's de

73: cont

us sio the

r n ma IVER uspen oa Is uch a teca

SP family velopment

CONNIV rol strjc n of TMT database

t eher is is its aoi ded anima t or alter

n envi ronm use some s

of of a ER's ture Hit .

and more I i t y ion, nate ent • mall

CONNIVER is less a programming lani,ua-e than it is a collection of ideas about control structure. (The language apparently has never been used for more than one or two significant programming tasks CFahIman7i]). Because of this, our discussion will omit most references to syntax, and highlight only the aspects of CONNlVtR's control structure which are unusual or unique to it.

3.3.1. Fr.4m.g5j Ay;r£y.2ir and Ap;ie.u.

In a conventional programming language (MP included), one function calls another function either by name or pattern and waits until the called function returns control. In a conventional lanouage, once a function returns, that copy of it dies; the function may be calleo anew, but the new call will cause a new "copy" of the function to begin. No memory of a function s current status can be preserved across call-return sequences. This type uf control is usually carriea out under the control of push-down stacks which record callina arguments and return addresses; calling a function causes stacks to be pushec, while returning from a function causes stacks to be poppeo, annihilating all control information.

in C rat he f rame f unct its etc.) user- a Iter free causi t o be c hron contr perma

In C ONNI r th

wi i on f ree . Th acce

its y/ar

not alt

0 log 01 1 nent

CNNIV VER an to U c at an

var ere a ssibl

own iab le he id er ed. icall s fre ly c

ER. is

pu ont y m iab re e or s ent

Se y e t los

thi to c shi ain omen le=>, two LISP anot to ity cond push o me in»

ng s a reate nf orm all

t (e. to

impor oat

he r f ue I of th , bee ed a ander any

re q a s

at io the

g.. who

tant a s unct ooke e f u ause nd

fr fun

ui te o-ca n on

i n from m i fea

t rue ion* d u ncti the

popp on c t i o

a Di lied to a forma what

t is tures ture. s f ra p on on to re i ed a one n. T

t diff "frame

cent t ion A-LIS to re of a

This me in some 0

wh ich s no t f unc funct i hus , a

e ren " fo ral need T it turn fra mea arb

ther con cen

t ion on t an

t. T r th sta

ed t de

whe me. ns t it ra fun

t rol tral ent

to y mo

o call e ca I le ck. A 0 chara r i ves n it ha First,

hat a f ry way c t ion s is to st a c

ryttx it the ne ment, t

a f d fu fun

cte r valu s fi

it unc t s » A-L

be r wh

, ex xt here

unc t ncti c t i 0 ize es ni sh

i s ion caus 1ST, et ur ich ec ut wi th can

ion on, n's the for eo,

a may in; or

ned i s

icn out te

23

••*"-•• • • -•

Page 29: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

—-——

numerous suspended functions which may te resumed at the point at which they last relinquisheu control« or in fact, at an arbitrary labeled point within t hem .

A t ec hni Partie funct i act ua I speci f s uppos type stack- lives t he t to mas meande

T whe re c ont i n per man app li c aenerw THFIND f i Iter amount possio c ana i o for a testin e ff ic i genera mai nta which

s on que ula r

( on

y fo ej t o< like on s r ee . k an r in^

e mi for

, si the will r ev/ o be ma rk

a rr ome

Al d u

of

o d ist in a f unc

ue, CONN ent ret ati on o tion of

in MP) ino tes

of time le to ates one

more g functi ent sea tors, C i ni ng " c ontrols

ght i

nee Soe ery

lo ing ang bra tho nma exe

gui tio IVE urn f

a to ts in

cal at

int ons rch ONN pos

th

ex terns

con teii. ), e

sus a i Cd , t tii'tn nch

Sp cuti

sh t n me K ae ) a the Iter jene ore

the I a

a t i mat tha

es : Vt.fi sioi e ex

pect, in t

t ro I ma in gene very fa pended 11 y pre he MP t to a of the there i fa c ts on cont

this he da y even ra I ha ct in funct i sent * conte

tree o tree» s cons in th rol fr

he pe r rely r f i nes nd AU AU-RE

native rate a applie

i nit i "gene ime t s e for n is be caus

has li t ies tract i

manent eIi nqui two me -REVOIR VOIR f s. Rat 11 ross d (a pr al coll rator" uspendi m of i pos s it

e of th some lists

on of p

abi li tabas tuall s no the d on, F hile xt s f CO and f idera e aa om on

ret ur shes thocs

(su eat ur her ible ocedu ec t in f unct ng it nt era le i is in rath

"» ,J oss lb

ty c y b way a t a

» * F 1 ehe nte unc ble tab e f

n o con

o spe e tha can re U ion sei cti n t im er ncl i li

makes more c e retur of kno

base mu h e t h e r s runni me was x t s . £ t ions h overhe

ase in unct ion

f a f un t rol, r f ret u ns i on). is in n ca 11 i didates which m phase), whi ch

f acros on oetw MP, an acy. TO

e UDO uding ties f r

the ompl ned wine st h or n ng.

dSl C d ve ad,

sy to

co e x to whe

a ve ot To a nera ally a cce the nchr t he

nte xt t han i a ny s t he r o mar k i n t hat c c o m p I I w eu t eve ss to system ony w next .

c t i on e se r v r ni ns

One the

ng a bef o

ay wa in

«ill s ca een t J ca

f ac i rate a fu om su

f r ing : A

ve (of

•'unc re ste CON

loca Us. Se ? lita

mo net i ch I

om t the o DIEU r> i ten t i on any an in Nl VER te an

Thi ene ra ead te th chine on , T is t s .

ma r K n Ap. uspen r not c s wh ?act i sh t f r orr.

ry f limbs iidriu

itn

he c pt i on (f in

mpo r t cost (SüCh det ai orain

i t d ret s mo ting to m e use ry RY-NE

in In

di J i t

i».h i :

his b

oC t of

»«• -

the

att- ic

of, t

ly)

leü a 11

i i, urn kt E •nd ore of

for XT,

C ome ot at ion comput ati on in t he orems a "methods". Except

in CONNIVER is similar MP. The counterparts of

are, respectively. IF-ADDED, for differences in

scheme , t he se illC i IIU , i . l_ A V. C ^ L I \J , WIllClCri^CTJ

pattern-directed invocation scheme, as the r.P versions. CONNIVER c gGo l-statement functions, THASSE respectively, ADO, REMOVE ana FETCH.

in most other THANTE, THFKASIKG

IF-KEMOVED and syntax, anc a three Tunc t i ons

ounterparts of NIP'S RT, THERASE and

reoaro s t c and TnCON_L

I F-\iEtD£D more general

are the sane oatabase •na

THGOAL art,

3»*« L11 j£ie.nc.v. of tng LISP Langya^g EsEÜi.

Bein;, an interpreted languaqt, LISP is slower than, say, by between one and two orders of magnitude. However, con-gitec be competitive with a good FORTRAN compiler. *e feel that L*T" the best of both .crUs, in the sense that the interpreter provides easy program development and debugging, while the LISP compiler transform debugged cooe into production-level efficiency.

FOKTRAN, LliP con provi dt s

"c r can

MICROPLANNER ano CONNIVER, on the other hand, are inherently le^s efficient, primarily because of the control structures they superimpose on LISP. The fdtal flaw with MP is its backup systtm, which can te extremely slow; compilation will not typically remedy the problem. r'RFITvPR" is slo- for similar reasons; however, in addition to data structures, processes must also be garbage collected, and an elaoorate context tree'must ue maintained. Although these two languaoes contain many noteworthy features, we feel that neither (as currently implemented) is appropriate for production app I icatiens .

24

»mim

Page 30: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

*mmm*m*^*l

3.5. äiaQdacdiiüifiQ si lb« LI&£ LiQfluass tamiix

ÜNIVAC others ant ic i i nclad there the s are ac about c ha rac FinaU wri tte

here are 1106, 1

• teinj pate no i ng mic is «.xact emant ics c es sec ,

one da ter iiea y, most n i n LIS

LI 108

a s

roc ly

o sue y's as LIS P i

SP sy s , 1110

re la igni f i ompu te ont ai f how h "1 nc

wort a lang f sys tstlf.

tens . CD tive cant rs. alec f unc ompa h of uage terns

for the following machines: PDP-1C, PDP-11, C 6500, 66CD, 1EK 360, 37G. SIG^A 5, ar.j ly easy language to implemtnt, we wool:

development problems for any machine. Since LlSP's syntax is nearly non-existent,

t. Although there are minor differences in tions are defined, and how variables values tibilities" can normally be ameliorated in macro-writing, because of this, LISP can b< which is fairly standard and transportable,

have an accompanying compiler, usuoll:

25

ätmiium*,,

Page 31: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

^^mmm^mmmmmmmm

ÜSkäted LäDäüääSS

4.1. AL

AL is a h igh- level manipulatory tasks, developed Ldoorätor; LFinkel7«,3. It is a runtime support for controlling

programming system Stanford at

SAIL-Mke devices•

for specification cf Artificial InteIligenet

language and induces lar^t

Trajectory calculation is a crucial feature of manipulator/ control. AL contains a wide range of primitives to support efficient trajectory calculations. As much computation as possible is done fit compile-time ano calculations are modified at run-time only „s necessa ry .

öesiaes a oiniensionless scalar data type (i.e., CE*L), AL reco^nwes and manipulates TIME. MASS and ANGLE SCALAPs, di irension 11 ss and typed VECTORS, ROT (rotation), FRAME (coordinate system), PLAt.- (region separator) anQ TRANS (transformation) composition of variables of these types gives performing calculations of any type of movement.

data types. Proper a s imp le irean s of

.

Also included are PL/1-like ON-conoitions, of the outside worlu, and concurrent processes.

which allow monitoring

Examgle^

PLANE p1;

•C statements initializing p1 3

SEARCH yellow

ACROSS *ITH I REPEAT

?EG

Pi NCREM 1NG IN FRAME set _ MOVE

ENT = 3*CM

i SEARCH is a primitive which causes a hand to nove over a specifiec area. yellow is a hand >

{ hand moves across plane > •f everv 3 c • >

set; ye llow;

ON

MOvE

END.

\. no'iu HI w» c ; o •C every 3 cm >

< do at every iteration >

r -, i yellow is also coord system of hand J yel low XOR - Z*CV

< move hano 1 cm down from current position alon, I-axis >

FOSCc(Z) > 3000*DYNES DO TERMINATE; < keep in touch with real world }

yellow TO set DIRECTLY; <. meve the hand back to where it was in a straight line >

26

Afcii'h- •'- .**?:: J

Page 32: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

4.2. ÜLI&E

MLISP (meta-LISP) is a high-level list-processing language developed at Stanford University CSmith703. MLISP programs are translatec into LISP programs which are then executed or compiled. The MLISP translator itself is written in LISP.

MLISP is an attempt to improve the readability of LISP programs *« well as alleviate some inconveniences in the control structure of LISP (e.g., no explicit iterative construct). Since run-time errors are only detected by the LISP system (when actually executing the program), users frequently find themselves debugging the translated LISP code. This some»hat defeats the purpose of any high-level languaqe.

All LISP functions are recognized ana translated in MLISF, but the Cambridge prefix notation of LISP has been replaced by standard infix anc prexix function notation. Instead of (PLUS X Y) one may write X • Y, ano (F00 'A B C) becomes FOOCA, 9, C).

MLlSr also p roviues a powerful set of iterative statements and t Idr^e number of "vector operators." Vector operators are used to apply standard operators in a straightforward manner to lists. Thus, in 1LISP, <1, Z, 3> *3 <6, 5, 4> yields <7, 7, 7>. +3 is the vector aadition operator and <A, a, C> is equivalent to (LIST A 6 C) in LISP.

E£ä8>ui£i

Given a list of the form <obj1, objZ, • ••> objn>. this function will return a list of the form <<obj1, holder1>, ..., <ocjn, holdern>> where holderi is either PLIERS, VISE or NOTHING accordingly as needed to hold the object. * ...X is an MLISP comment»

EXPR HOLD-LIST(OBJ-LlST); BEGIN

NEW S; RETURN

FOR NEW OBJ IN OoJ-LlST COLLECT

J. EXPR starts a regular func

X local declaration * RETURN is a unary operator

IF 'SIZE))

END;

(S GfcMOoJ, THEN

<<0BJ, 'PLIERS>> ELSE

IF S LEwUAL 10 THEN

«OBJ, 'VISE>> ELSE

«OBJ, "NuTHlNG>>

OBJ is local to the FOR loop. OBJ will be bound in turn to each element of OBJ-LIST. COLLECT indicates that the result cf each iteration is to be APPENDed to the previous result and this whole list returned as the result of the FOR. LEQUAL 5

X X X X X X X X X

27

"--^"-—»—-- - -^-'- - -^-^^

Page 33: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

*«3« PQlzi

POP-«, is a conversational language desioneo by R* M. Eurstall and A. J. Popplestone at the University of Edinburgh [Burstal171j.

POP-* features an Algol-like syntax and draws heavily from LISf. Integers» reals» LlSP-like lists and atoms (called 'names ), function constants (lambda expressions)« records» arrays, extensible data types, and run-time macros are supported* A unique feature of the POP-_ system is the heavy use of a system stack» which the user may easily control to enhance the efficiency of programs*

A full complement of Iist-manipulation, numeric an- storage-management functions are available*

Suppose we wish to ootain a list of all machinery not functioning* A useful function would be,

current Iy

COWMEN* sublist returns a list of all elements of argument list xl which satisfy argument predicate p ;

FUNCTION sublist xl p; VARS X ' IF nult(xl) THEN nil

i arguments are xl and \. > < declaration of local, no type > < just like LISP >

ELSE hd(xl) -> x; <. ha(a) = (car a) > IF p(x)

THEN x: :sublist(tl(xl>, p)

CLOSE END;

U(»Ui (J J i tl(a) • (cdr a), x::l = (cons x I) >

ELSE sublist(tl(xl), p) CLOSE

A call mifeht then look like,

suDlist(maChine-l ist» LAMBOA m; not<functioningCm)> END);

which right re turn,

Cpunch-pressl drill-press2 unitlOD

which is a POP-2 list.

4.4. 3L.ISE

«LISP is an extended version of »A4 (a PLANNER-like LISP derivative) CRulifson 1973D embedded in the sophisticated INTcRLlSP system. CLISP supports a wide variety of oata types designed to aic in the flexiolt: handling of large oata oases. Among the data types supported *rt "TUPLt," "BAG" ano "CLASS." A TUPLE is essentially a LISP list that can ce retrieved associatively (see below). A BAu is a multiset, an unoroereo collection of (possibly duplicated) elements. Bags have been found to be useful for describing certain commutative associative relations. A CLASS is an unordered collection of

28

mate write •fei .,.*»••

Page 34: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

•Mi

non-duplicated elements (i.e., basically a set)«

Arbitrary expressions may be storea In the system data base ano manipulated associatively. The QLISP pattern matcher Is used to retrieve expressions In a flexible manner* The system function MATCHUi may be used to Invoke the pattern matcher explicitly, as In:

(hATCHQQ (<-X <-Y) (A B>>

which causes X to be cound to A and Y to B ("<-" indicates this "neeJ for d binding")« The patterns to MATCHGQ may be arbitrarily complex, as in:

(HATCHQQ (A (<-X <-Y) ) (<-X (A (B C))))

in which X is bound to A and Y to (B C).

QLISP expressions are unlike LISP where only "identical" expressions» expression by QPUT.

represented uniquely in the data bast, atoms are unique. To distinguish between "properties" may be associated with any

(taPUT (UNION (A B)> EUUIV (UNION (B C)>)

The above puts the expression (UNION (B O) unoer the property EQulV for the expression (UNION A B).

QLISP provides facilities for backtracking invocation of functions, as illustrated by:

and pattern-directed

(«LAMBDA (FRIENDS JOE (CLASS <-F <-S <-<-REST)) (IS (FATHER SS SF)) BACKTRACK)

This JOE. REST will

function will find an occurrence of a CLASS denoting FRIENDS of F and S will be Dound to the first two elements of the CLASS and

be bouno to the remainder of the CLASS (indicated by "<-<-' If S is a father of F, then the function succeeds. current binding of its argument to be used.) BACKTRACK causes re-invocation of the function with new bindings for S, F and REST until the function

("$' _,..,.,.. to be used.)

the function with new bindings for S, F succeeos or there are no untried 'bindings •

') the

The user may collect teams of functions desired circumstances. Many QLISP

optional arguments which

ntiiwni to be invoked under data base manipulation functions may

. . - denote a team of routines to be used to perform antecedent-type functions have

(as in PLANNER).

QLISP provides a general context and generator mechanism similar to that of CONNIVER. Also provided is a smooth» readily accessible interface to the underlying INTERLISP system which aids In the development and maintenance of large systems.

1, multiprocessing Future plans for QLISP Include

semantic criteria for syntactic information)« and the atility for the pattern return more information than a simple match or fail.

pattern matching (as opposed to primit1ves» the current matcher to

29

Page 35: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

"'.•••.M • " "'

5« §* äSBiSi

5.1. lDl£2Sy£ii2D

A common exa features of SAI variations the program-segments the most eficient language« but mer

Problem statement

Given two distinc from A2, and in the example is as

(1) Two hdnost LE and sensing f

(21 A fixed numbe

(2) A fixed numbe

(4) A fixed numbe

t assemblies (say AT and A2)» attempt to unscrew fc1 oicate success or failure accordingly. The "world" if sumea to include:

FT and RIGHT, capable of moving» qraspinb» twisting orce and motion.

r (possibly zero) of PLIERS

r (possibly zero) of VISES

r of "assemblies"

For each PLIERS ano VISE* the data base contains an assertion if the form. "PLIERS (VISE) # n is «t location (X, Y, Z) and is of capacity C cm." In addition* for each assembly the data base contains an assertion of the form» "assembly A is at location (X, Y, z) ana is of size S cm." As we shall see* the languages are distinguished in part by the methods each uses to represent such knowledge.

Each example assumes the existence of the routines describeo belcw in ALGOL-like notation.

ATTACHED(A1» A2) - TRUE if and only if the assembly represented of AT (hereafter referred to as A1) is attached to the assembly representeo oy A2 (referred to as A?). The routine has no side effects.

MOVE(HAND. LOCATION) - Moves HAND* (LEFT or RIGHT) to LOCATION (but PLANNER'S description of MOVE).

ste

TUIST(HAND. DIRECTION) -Twists HAND (LEFT 0. DIRECTION) - Twists HAND (LEFT or RIGMT) in the given DIRECTION (CLOCKWISE or COUNTER-CLOCKWISE). The DIRECTION is oriented looking down the length of the arm. Except for SAIL« all programs assume a routine called TWIST-BOTH, which causes both hanas to twist at once.

GRASP(HANt/, OBJECT) - Causes HAND (LEFT or RIGHT) to grasp OoJECT, whici must oe within some fixed range of HAND (i.e.» the hano must MOVc to the OBJECT first).

ATTEMPT (ObJ1» OBJt, Al» A£) - Attempts to do the actual unscrewing of assembly A1 from A2 using objects wBJl ana 0EJ2 (which» in our examples, are either VISEs or PLIERs). ATTEMPT returns TRuE if and only if the attempt is successful.

Each program applies the following sequence to solve the problem:

(1) Attempt to unscrew the assemblies using the hands. This entails ootaining the location of the assemblies» moving the hands to their respective locations» graspin»» and then twisting.

30

Page 36: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

mwuwmWHt •*«*' I' u.—w—•"•I'T—r '-tm^-w •! ,.•»••'

(2) the objects longer attached, then return "success*1

U) An attempt to use PLIERS has failed, holding one of the assemblies In appropriate VISE. This search proceeds In (3).

Try to solve the problem Ly a VISE. Perform a search for an

In a fashion similar to that

(5) All attempts "failure".

nave failed. Output an appropriate message and return

31

-'----'•••-^ HB ' JmW.

Page 37: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

- - - ;•"•: •

9

5.2. §Ali

5.2.1. SgteiE ££fiS£ä£

c 3 4 5 6 7 & 9

\\

\\ u 15

\S H 20 21 lc 23 24 25 26 27 2i 29

IS I! 34 35

J 3ö 39

tt a 44 45 46 47 46 49 50 51

H J

I* 58 59 60 61 62

INTEGER PkOCEDURE B IGENOUG H (I TE KVA & HOLDER, HOLDEE);

BEGIN

" RtTURN TRUE IFF OBJECT HOLOER IS LARGE ENOuGH TO HOLD OBJECT HOLDEE "

INTEGER ITEMVAR C, S;

C COP(CAPACITV XOR hOLDEfc); S " COP(SIZE XOR KOLDEE); RLTG&.\*CDATUM<C) GEG DATLK(S))

END;

INTEGER PkOCEDURE UNSCREW(ITEMVAR A1, A2);

• ATTEMPT TO DISASSEMBLE ASSEMBLY A1 FROM A2, BY UNSCRcWING "

BtGIN

DEFINE fcUNMt = 1;

ITEMVAR V1, PL1, PL2, P1, P2;

INTEGER FLAb;

IF NOT ATTACHEDCA1, Ac) THEN RETURNd); " DON'T BOTHER "

MGVECLEFT, LOCATION XOR A1); MOVECRIGHT, LOCATION XOR At>; GRASPCLEFT, A1); GRA$P(RIGHT, A2);

" GET BOTH HANDS TWISTING AT ONCF "

SPR0UT(P1, TW1ST(LEFT, COUNTER!CLOCKwISE). RUNME); SPROUT(P2, TWISTCRI6HT, COUNT ER!CLOCKWISE), RUNME); J0IN(<P1, P2>); IF NOT ATTACHEDCA1, A2) THEN RETURNd);

" HANDS NOT STRONG ENOUGHt TRY PLIERS "

FOREACH PL1, PL2 | . . ISA XOR PL1 EQV PLIERS AND (BIÖENOUGH<PL1, AD)

AND ISA XOR PL2 EQV PLIERS AND (PL1 NEG PL2> „ ., , AND (BiGENOU6H(PL2, A2)) AND (ATTEMPT(PL1, PL2, A1, A*))

DO RETURNd );

" EITHER THtRE «EREN'T ANY PLIERS LARGE ENOUGH, OR THE PLIERS WEREN'T STRONG ENOUGH. TRY A VISE ON ONE SIDE "

FOREACH vJ|ApLjRly1 Eev vl$t AND (B16EN0UGH(V1, AD)

AND ISA XOR PL1 EQV PLIERS A:,D (BIGENOUGH(PL1 , A2)) AND (ATTEMPTCV1, PL 1, A1 , A2))

DO RETURNd);

• ALL ATTEMPTS FAILED "

32

Page 38: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

\

64 OUTSTRCTAN'T UNSCREW • & CVU (A 1 , FLAG) t " I 65 & CVIS(A2t FLAG) & < 15 t ^(.^^. 66 RtTJRN(v) 67 6 b EhD;

33

Page 39: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

•' IM"

5.! £fii!£Qiatx

2.

9.

11.

13.

20.

47.

4S.

50.

64.

In SAiL, FALSc =

C and S are items

LOP(<set>) retur there exi sts onl < c ap«c ity > for e

C one S are nece most know at c numeric test for

OVSCKEW i s a BOO succeeos in un*c

This is a ma cro S AIL compiler, for its use.)

SPR00T is a »AIL argument (a pr argument is an i information «bou thirc argument the created proc current and ne s checu ler .

Ü, TRUE <> 0. BICENOLGH is u 3C0LLAN procedure.

whose DATUM is assumed to be of INTEGER typt.

ns the first item of <set>. We are assuming that y one triple of the form CAPACITY XOR <cbject> Ei.V ach <object>.

ssary because DATUK(C0P(<set>)) is illegal« iAU ompile-time what the type of a DATUf» is. GE* is a greater than or equal.

LEAN procedure which returns TRUE (non-zero) if it rewing the objects.

aefinition. whenever RUNML is encountered by the it will be replaced oy the constant 1. (See 59«

function which causes activation of its >eccno ocedure/function call) as a process. The first tern whose DATUM will be set oy SPROUT to contain t the SPROUTed process (see 41. for its use). The to SPROUT aetermines the status of the current an: ess. RUNME (bit 55 set) indicates that tnt w processes are to be run in parallel by the SAIL

bOOLtAN tests in a FOREACH must be enclosed in parentheses.

NEW PL2) to insure that two distinct pairs of pliers Notice (PL1 are found.

If the body return succe

C VIS is a SA 'name' asso the presence

of the FOREACH is entered, then all went well and »e ss.

1L function which will return a character string cioted with an item. FLAG is set by CVIS to indicate

of an error.

34

"*-—

Page 40: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

5.3. int

5.5.1. iilfclt P£S&£än

i 3 i 5 o 7 a 9

10 11

\\ 15

to

It !? 22 13 !4 !5

30

\\ 33

Ü 36 37 36 39

»

43

tl 4L 49

I?

(liEFUN UNSCKE

? ATTEMPT

(PR06 (PL1 PL

(COND I

(MOVE * (MOVE * (GRASP (TW1ST- (COND C

? HANDS

(COND C

w (A1

OISAS

2 V1

(NOT

LEFT KIGHT 'LEFT BOTH (NOT

A2)

SEMBLV OF OBJECT A1 FROM A2, BY UNSCREWING

IN)

(ATTACHED A1 A2>) (RETURN 1)1)

(GET A1 'LOCATION)) (6ET At 'LOCATION)) A1) (GRASP 'RIGHT Ac)

'COUNTER-CLOCKWISE) (ATTACHED A1 A2)) (RETURN 1)1)

NOT STRONG ENOUGH, TRY PLIERS

(FORE

))

ACH PL1 IN PLIERS-LIST (BIGENOUGH PL1 AD PL2 IN PLIERS-LIST (AND (NOT (E6 PL1 PLC))

(BIGENOUGH PL2 A2)) DO (ATTEMPT PL1 PL2 A1 A2))

(RETURN 1)1

? PLIERS NOT LARGE ENOUGH OR NOT STRONG ENOUGH. ? TRY A VISE ON 1 SIDE

C(FOREACH VI IN VISE-LIST (BIGENOUGH V1 A1) PLl IN PLIERS-LIST (BIGENOUGH PL1 A2)

DO (ATTEMPT V1 PL1 A1 A2)) (RETURN T)J

? ALL ATTEMPTS FAILED

CT («>RIN1 "CAN'T UNSCREW ") (PRIN1 A1) (PRIN1 " t ") (PR1N1 A2) (TERPRI) (RETURN NID3)

(DEFUN BIGFNOUGH (HOLDER HOLDEE)

RETURN T IFF OBJECT HOLDER IS LARGE ENOUGH TO HOLD ODJECT HOLDEE

(NOT (LESSP (GET HOLDER 'CAPACITY) (GET HOLDEE 'SIZE))) i

i4 55

60 61 62

(DEFSPEC FOREACH (LAMBDA (0BJ1 IN1 LIST1 PRED1 0BJ2 IN2 LIST2 PRED2 DO TRY)

? MIMIC SAIL FOREACH IN SIMPLE CASE

(PROG (TEMPI TEMP2)

35

•~^:-ü^g...^.j. ~-mmuimmdit- MWMMM

Page 41: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

~^m

63 6«. 65 66 67 66 69 70 71 72 73 74 75 7o 77 7b 79 S3 31 32 il ck 85 36 &7 3b 89 90 91 92 93 y4 95 96 97 98 99 100 101 102 103

LOOP1

LÜOP2

)))

(SETO T£MP1 (EVAL L1STD)

(COND t(NULL TEMPI) (RETURN NIL)]) ? PAN OUT (SET 05J1 (CAR TEMPI)) (SETQ TEMPI (CDR TEMPI)) (COND C(NOT (EVAL PRED1)) (GC LOOP1)]) ? FAILED 1ST TEST (SETO TLMP2 (EVAL L1ST2))

(COND [(NULL TEMP2) (GO LOOP1)]) (SET OBJ2 (CAR TEMP2)) (SETQ TEMP2 (CDR TEMP2)) (COND [(NOT (EVAL PRED2)) (GC LOOP2)3

C(EVAc TRY) (RETURN T)3 [T (CO LOOP2)3)

? IT WORKED

(DEFMAC FüRtACH (LAMBDA (OBJ1 IN1 OBJ2 IN2 DO TRY)

LIST1 LIST2

PKED1 PRED2

? MACRO VERSION OF FORcACH

(LIST

'LOOP1

'PROG 'U1 L2) (LIST 'iETQ *L1 L1ST1)

'LOOP£

(COND [(NULL L1) (RETURN ML)]) (LIST 'SETQ OBJ1 '(CAR L1 )) (SETQ L1 (CDR L1)) (LIST 'COND (LIST (LIST 'NOT PRED1) (LIST 'SETQ 'L2 LIST2)

))

(COND [(NULL L2) (GO LOOPD3) (LIST 'SETQ 08J2 '(CAR L2)) (SETQ Lc (CDR L2)) (LIST 'COND (LIST (LIST 'NOT PRED2)

(LIST TRY '(RETURN T)) '(T (GO LOOP2))))

'(GC LOOP1)))

(GO LOQP2))

36

Jitt

Page 42: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

. , U..II... . i ii in,.,,i .!..„., in» .in.«,..«., i. i.imi m nwmap

um '"i

5.3.2. £ylB£Qiä£i

13.

18.

19.

34.

35.

47.

55.

63.

66.

66.

72.

UNSCRcW is the main function. disassembly .as successful.

Unlike SAIL» LISP does not support co primitive function to get both hands

FOREACH is an iterative special form FOREACh. FORcACH will try pairs predicates succeed or it runs out of Note that the arguments to a special

It returns

ncurrency. twisting.

if and only if

We thus assume

which mimics a simple SAlc of pliers until the qivtn pliers (and returns NIL).

form need not be quoted.

Check to insure that distinct pairs of pliers are found.

PRIN1 is a LISP function which loads its argument into the stream output buffer.

TERPfcl is a LISP function which dumps the output buffer.

Return T if capacity >= size.

times called a FEXPR). A LISP function except that its

DEFSPEC defines a special form (some special form is identical to a arguments are passed unevalu&ted.

EVAL is necessary since the argument was passed unevaluated.

Note the use of SET rather than SETQ. to fett the intenoed atom (SET evalu does not) •

Note the use of EVAL (see 63.).

Note the use of se.T (see 66.).

This is an alternative macro version a PROG which is similar in nature Note the absence of SET or EVAL.

0bJ1 needs to be evaluated ates its first argument» SETQ

of FOREACH. It expands into to the special form FOKEACH.

37

Wfa*b L—- t A , ' j

Page 43: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

wfm^m»

5.4. PL.A&N.E.B leitBOELAN5jk52

5.4.1. isSüEie E£fi^£äCD

2 3 4 5 6 7 £ 9

13 11 12 13 U 15 16 17 1ö 19 23

lc 23 24 25

\S 28 29

I? i

34 35

i? 3b 35 43 41 42 43 44 45 46 47 45 49 53 51

l! 54 55 56 57

II 63 61 62

(THCONSE uNSCREW (A1 A2) (UNSCRtW (THV A1) (THV A2D

ATTEMPT DISASSEMBLY OF OBJECT A1 FROM A2, EY UNSCREWING

(THOR (THNOT (ATTACHED (THV A1) (THV AZ>)) (THAND

(TH60AL (MOVE LEFT (THV AD) (THT^F THTRUE)) (TH60AL (MOVE ÄIGHT (THV A2)) (THTBF THTRUt)) (SRASP 'LEFT (THV AD) (GRASP 'RIGHT (THV A2D (TWIST-BOTH 'COUNTER-CLOCKWISE) (THNOT (ATTACHED (THV AD (THV A2)))

)

? HANDi NOT STRONG EN0U6H, TRY PLIERS

(THPROb (PL1 PL2) CTH60AL (ISA (THV PLD PLIERS) (THTSF THTRUE)) (ThGOAL (BIGENOUGH (THV PLD (THV AD) (THNODB)

(THUSE BIGENOUGH) (THTbF TwTRUt)) (THGCAL (IS* (THV PL2) PLIERS) (THTBF THTRUE)) (THNOT (EC (THV PLD (THV PLZ))) (THGOAL (BIGENOUGH (THV PL2) (THV A2)) (THNODB)

(THUSE LIGEN0U5H) (THTbF THTRUD) (ATTEMPT (THV PL1) (THV PL2) (THV AD (THV A2))

? NO PLIERS LARGE ENOUGH, OR NO PLIERS STRONG cNOUGH. ? TRY K VISE ON 1 SIDE

(THPROG (V1 PL) (TnGOAL (ISA (THV V1) VISE) (THTBF THTRUE)) (THGOAL (BIGENUU6H (THV VD (THV AD) (THNCDB)

(THUSE BIGENOUGH) (THTBF ThTRUD) (THGOAL (ISA (THV PL) PLIERS) (THTBF THTRUE)) (THGOAL (EIGENO GH (THV PL) (THV A2)) (THNCDB)

(THUSE LIGENOUGH) (THTEF TuTRL't)) (ATTEMPT (THV VI) (THV PL) (THV AD (THV A2))

)

? NOTHING «ORKED, JUST FAIL

(THNOT (THDO „ (PP1N1 "CAN'T UNSCREW ") (PRIN1 (THV AD) (PCIN1 " ") (PRIN1 (THV A2)) (TERPRI)

)) (THFAIL THEOREM)

))

(THCONSE oltoENOUGH (HOLDEk HOLDEE C S) (BI6EN0UGH (THV HOLDER) (THV HOLDEE))

? SUCCEEDS ONLY IF OBJtCT HOLDER IS LARGE ENOUGH TO HOLD ? OBJECT HOLDEE

(THGOAL (CAPACITY (THV HOLDER) (THV C>> (THTBF THTRUE)) (THGOAL (6IZE (THV HOLDEE) (THV S)) (THTBF THTRUE))

38

•M«W>

Page 44: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

— .L H.lüllll ). " • ' ' "-"•""•"

63 (1HCOS0 C(NoT (LESSP (THV C) (ThV S)>) 64 ITHSüCCEED)3 65 C7 (ThFAlL THEOREN)]) c>6 )

39

L y—'—-s-r-- ••• - ^_

Page 45: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

1' " PÜ I •'" I JJ" • •a j n >^««>

5.4.2. CfiSBtDifirx

Defines and asserts a consequent theorem with name UNSCREW.

This is the pattern on which to invoke this theorem if neeoeo (e.g., (UNSCkEw ASSEKBLY1 ASSEHBLY2>) .

THOR sequentially executes each of its arguments until one succeeds» and then the THOR succeeds. The THOP is used here to prevent undesireo oackup.

(THNOT p) is aefineo as (CONO Cp (THFAIL>3 CT (THSUCCEED)2) .

THAND succeeds if and only if all of its arguments succeeo. unlikt THOR» backup may occur among the arguments of a THAND.

Atteir.pt to move the left hano to object A1. There may be sevtr.l experts (theorems) on moving hands• PLANNER will try as many as it needs. (THTBF THTRUE) is a theorem base "filter" which is satisfied by every theorem.

THPROG behaves in a similar manner to THANU except that local variables may be declared.

Attempt to fino a pair of pliers.

See if the pair of pliers is large encugh. (THNODc) indicates to PLANNEK not to mother searching the data base. (THUSE <theoretr>) inoicates to try <theorem> first.

Hake sure that we have two distinct pairs of pliers.

THDO executes its arguments and then succeeds. nowever, at this point we know that we have failed, and THNOT is used to generate s failure from THDO. This is necessary because PRIN1 returns its first argument as its result» which (being non-ML) would cause the THOR to succeeo.

49. Generate explicit failure of the theorem.

7.

o

9.

10.

19.

20.

21.

24.

45.

40

"^n -T ri'ii „__

Page 46: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

'•'

5.5. tÜNjsl^tg

.5.1. isBfeig Prfis.£äffi

1 2 3 i 5 6 7 w 9

10 11 12 13 14 15 16 17 16 19 20 21 22 23 2H 25 26 27 2& 29 30 31 32 33 3H 35 36 37 3b 39 40 41 42 43 44 45 46 47 4ö 49 50 51

[j 54 55 56 57 5o 59 60 61 62

(CDEFu

? A

N Ui.SCR

TTEMPT

"A

(CO*D [

(PRCSLN (PRtSt.N (MOVE ' (GRASP (COND L

elf (A

TO DI

UX" (

(NOT

T '(L T '(L LEFT 'LEFT (NOT

1 A2>

SASSEMBLE A1

LOC1 LOC2 GEN

(ATTACHED Al

OCATION OCATION LOC1) <M A1) (6k (ATTACHL

•fA1 !,A2 OVE ASP D Al

FRO.'' A: , B r UKSCREw litt

1 6E,\2 V1 PL1 FL2)

A2) ) (RETURN T)3)

!>L0C1)) !>LOC:>)

'RIGHT LCCZ)

RIGhT A2) A2)> (RETURN T)3)

? nA.\DS NOT STRONG ENOUGH, TR/ FLIERS

(CStTw

:HL00P1 (CSLT« (CStT*

oENl («Gt

PL1 ( *EN2

•"((«POS NERATOR

TRY-NEXT •"((«POS

(«GEN

SISIL (NEXT

G£N1 SIEIL ERATO

ITIES) «IGNGSF -OLJ 'PLIERS '(EIGfc^GUGM I » 1 ) ) ) ) )

:PLOOP2 (CScTu PL2 (TRY-NEXT GEhZ (CONC C(ATTEMPT PL1 PL2 A

CT (GO 'PLOOP2)J)

'(GO 'TRY-VISE))) lTItc) «IGNORE R (NEXT-OBJ 'PLIERS '(AND (NOT (EU PL1 i>)

(älGENOUGH S AZ))))))

'(GO 'PLO0P1))) 1 A2) (RtTüRN T)j

? ,\0 PLIERS LARGE ENOUGH ? ENOUGH. TRY A V,St GN

:TRY-V

:VLOOP

ISE (CS LTV. bEM »"((«POSSIBIL

(«GENERATOR (NE

I OR »LIERS NOT STRONG ONE SIDE.

ITIES) «IGNORE XT-OLJ 'VISE '(PIGENOUG* *. A1)))))

(CS (CS

: KL00P3 (CS (CO

'(GC 'NC-CAN-DO))) _ITIES) «IGNORE

(«GENERATOR (NEXT-GSJ 'PLIERS '(PIGENUU6M i A«.)))))

Hi. V1 (TRY-NEXT CEN1 LT» «EN2 !"((»P0SSI9IL

tTu PL1 (TRY-NtXT GEN? ND [(ATTEMPT V1 PL1 A1

CT (GO 'PLOGP3)D)

ALL ATTEMPTS FAILED

'(GC 'VLOCP))) A2 ) (RETURN T)3

INO-CA

)

N-D (PR (PR (RE

INI "CAN'T UNSCRtU ") (PRI\^ A1) IN1 " ") (PRIM A2) (TERFRI) TURN NIL)

(CDEFJN BiGENOUGH (HOLDER HOLDEE)

? RETURN T IFF OBJECT HOLDER IS ? ENOUGH TO HOLD OBJECT HOLDEE

"AUX" (C S)

.ARGE

41

*-m *m

Page 47: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

(PRESENT '(CAPACITY '.HOLDER !>C>> (PRESENT '(SIZE ».HOLOEE ! >S)) (NOT (LESiP C S>> j ) f

(CDEfUN NtXT-08J (TYPE PReD)

? GENERATOR TO RETURN NEXT ObJECT OF 'TYPE' ? aHICh SATISFIES *PREl/'

MAüXH (OBJ TEMP)

(CStTw TEMP (FETCH '(ISA !>OtJ !,TYPE))) LOOP

(TRY-NEXT TEMP '(ADIEU)) (CONC C(CVAL (SUBST OBJ *% PRED))

(NOTE OBJ) (AU-REVOIh)D)

(60 'LOOP)

Page 48: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

—.

5.5.2 • £fiBS£Qtar^

6.

10.

15.

CDEFUN defines o function to CONNIVER.

"AUX" <list> oefines local variables.

PRtStNT is a CONNIVER function which searches the data base for un item which matches its pattern argument. If one is founo» PRESENT sets the indicated variables (marked with !< or J> ) «no rtturr.s the ite.n. !fA1 indicates the current CONNIVER value cf A1 . !>LCC1 indicates that L0C.1 is to be Pound if possible.

OEM is oein« ossigned ö TRY-NtXT possibilities list. •" tells CONNIVER to do a "skeleton expansion" of the followinq list (which is necessary to CONNIVER's internals). The (*P0SS1PILITIES) an- •IGNORE are syntatic markers to TRY-NEXT whose function we can ignore. (*bENERAT0R <func-call>) indicates to TRY-NEXT to ust <func-call> to generate additional possibilities if needed.

19. NEXT-OBJ will continue to generate objects of ;ument >•

type PLIERS which satisfy the predicate (2nd"argument>. It will generate one PLIERS at a time. (&IGEN0UGH S AD is a skeleton predicate which NExT-OEJ will use to screen e«ch possibility. The current candidate is substituted for S before the predicate is CVALuatto (CONNIVER's form of EVALuation).

contains no more possibilities! TRY-NEXT will execute VISE). Unlike LISP» GO evaluates its argument here.

insure that two distinct pair, of pliers «ill be founc.

not necessary since the value of a CONNIVER function is expression evaluates.

21. •hen GEN1 (GO 'TRV-

24. Check. to

6 H . See 13.

66. RETUfcN is the last

72. £»e f i ne th regular f

79. FETCH is of all !>0BJ ind poss ib i li

•1. TRY-NEXT the curr (ADItU) i

22. The oesir object i returns a oc currenc

2?. (NOTE OoJ of 0i>J oi

!*. (AU-REVOI in a susp t xec ut ion

e generator unc t ion to

, NEXT-OtJ. Note CONNIVER until it

that NEXT-G?J looks like is called.

a CONNIVER primitive which r items in the data base whic icates that CBJ should be ty in turn.

binos ODJ from the Hossibili ent possibility. If ther s evaluated which causes ter

ed predicate is CVALuated af nto tne skeleton. (SUBST A list which is the result of

e of b in list C.

) is a CONNIVER function «hi to the current possibilities

R) returns control from NEXT ended state. when TRY-NEXT will resume at (GO 'LOOP).

eturns a possibilities list h match its pattern argument, bound by TRY-NEXT to each

ties list TEMP and removes e is no current possibility ruination of the generator.

ter substituting the current B C) is a LISP function which

substituting A for every

ch places the current value list. .

-OBJ out leaves the generator returns control to NEXT-OBJ»

43

Page 49: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

m —r-

generlcally better at the low level extensive abilities for

t. £0Q£iüSi2Q£

Either SAIL or LISP could provide an excellent basis for real-tiir.e Dlanniny and execution control of a large automated shop. However, each language possesses features which facilitate certain types of operations. In particular, SAIL is generically better control of I/O devices, and has «ore extent' interacting with the operating system (especially where file manipulations are concerned). LISP, on the other hand, is more flexible at the higher planning levels and where system development and debugging are concerned.

tie envision an "ideal" system as one which merges all trie desirable features of these two language classes. Such a merger woulc incorporate LISP's program and data structure format, augmented where necessary to accommouate SAIL-lihe file operations, and possibly IcAt-. SAIL features would be implanted in this environment, and, at tr.e implementor s discretion, an ALGOL-like syntax (such as MLISP) coulo Lt grafted onto the front of the system to make it more tractable.

in audition, such a merger should take following desirable features of SAIL anc LISP:

care to prese rve

(1)

(<. )

(6)

(7)

wata structures should information as well as structures should be free to , storage declarations should be

accommodate complex symbolic primitive types. As in LISP, data

grow in unrestricted ways, and optional to the user.

•og n jch

and data should, as in LISP, be in the same format. Such a representation underlies (a) a strong macro facility, (b) rapid editing, modification ano debugging of programs, anu (c) seIf-modifying and se If-ex tending systems. The last capability, for example, enables the system, given the description of a new type of tool, automatically to synthesize the programs for controlling the tool from a library of sub-functions.

(3) Strong I/O ana file manipulation facilities, as are found in SAIL, must be included. A good ranaom-access file system is imperative for even moderately large databases. The system should have both high and low level control over input and output formatting which provides control down to the bit level of the machine.

(4) A highly-oeveloped interrupt subsystem would be desirable. Hith the merger of SAIL's bit-wise interrupt control, and LISP s symbolic capabilities, such a system as is described in CRieger 76 3 could be efficiently implemented. This would serve as the network protocol for a large collection of highly autonomous processes where the synthesis and control of many parallel events is important*

(5) For software development and debugging, an interpreter should exist for the language. Nevertheless, the language should be have a compiler for production usage. LliP currently satisfies these requirements.

The system should provide for associative database. This engineering to coordinate a efficient random-access file some ideas on this topic*

large, context-sensitive, would involve some new

MP-like database with an system. [WcDermott75al surveys

There shoulo be some degree of automatic problem-solving control which includes a CONNIVER-like context-switching and process-suspending mechanism* Accommodations should be made for SAIL-like parallel process control, and emphasis should oe placed on inter-process communications protocols. Most of the ideas already exist in CONNIVER and SAIL, but they need to be synthesized into a unified system.

tne

44

atmm ate *a>«>tkfl>yatM«a>Mkbaw»i Mtak*

Page 50: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

. ... i ii i ii, i.. i-tvw

7* si^iibaciBbx

Cb«umaart72 3 Baumgort, b. 6. "Micro-Planner Alternate Referenc Manual," Stanford AI Lab Operating Note No> 67, pr- 1972.

t : I

CBBNcXECJ bolt. Eer<mek and Newman. "TENEX Executive ^anuil," Cambridge, Massachusetts, April 1973.

C£eech7o3 Seech, D. "A Structured View of FL/1," ACM Ccjmp.utinc Syrytys, Maren 1970, pp. 33-64.

Ccoorow74j Loo row» t). G. and Raphael, B. for Art ifi cial Intel li cence, September 1974, pp. 153-174.

"New Programming Languages

[burst a 11713 surstall, R. M.. Collins, J. S. and Popplestone» K. 4* Proorajminy in POP-2» The Round Table and Edinburgh On lversTTy Pr5ss »~Tv7T.

CChurch413 Church. A. The C.a.l£uli fif kaB,feäa Conversion. Princetcn university Press, Princeton, New Jersey, T9*1 .

CCOBOL^fci C030L. "American National Standard Programming Languabt CODOL," X3.32 - 1974, American National Standards Institute, Inc.* New York, 1974.

[C0DASYL71D CDDASYL Data Base Task Group. "April 1971 Report," AC«, Hew York, 1971.

COECJ DEC. "DEC System-10 Data Base Management System Programmer's Procedures Manual," Document DtC-10-ApPMA-B-D, Maynaru» Ma ssac nusett s.

rDijkstra753 Dijkstra, E.W.D., Lamport, L., Martin, A.J., Schölten, C.S.» Steffens, t.F.M. "On-the-fly Garbage Collection: An Exercise in Cooperation," Burroughs, Plataanstraat 5, NL-4565 NUcNEN, The Netherlands, EWD496-G.

[Fahlman733 Fahlman, S. "A Planning System for Tasks," MIT AI Memo 283, 1973.

LFelaman693 Feldman. J. A. and Rovner» P. D

Robot

"An

Construct ion

ALGOL-Based laman. «1 . «• <inu novner» r. v. nn sLcui-custu Associative Language," Communications of the ACM, August 969, pp. 439-449.

CFeldman713 Feldman, J. A. and Sproull, R. F. "System Support for the Stanford Hana-Eye System," Second International Joint Conference on Artificial Intelligence, London, September 1-3, 1971.

CFinkel743 Finkel, ft* , Taylor, R., Bolles, R., Paul, R. and Feldman, J. "AL, A Programming System for Automation," Stanford Artificial Intelligence Laboratory, Memo AIM-24X« November 1974.

CNeuitt693 Hewitt, C. ».."PLANNER : ^Language tor Proving Theorems

CLeslie7Z3

ig i Robots." Proc. IJCAI-1, 1969

in

Leslie. w.H.P. (editor). Nu.ge.ric.al £o.nt£2l. ElßSIäffiliöä L§nSue.d£5« North-Hoi lane Publishing Company, London,

"LISP 1.5 Programmer's Manual," The M.I.T. mbridge, ,1 as sac huse tf -

• "Recursive Functioi Computation by Mach-

A.C.JJ» April 1960, pp. 184-195.

[Levin65] Levin, M.I. tur I < J rruarmitr a n«n Press, Cambridge, Massachusetts, 1965.

CMcCarthyu03 McCarthy, J. "Recursive Functions of Symbolic Expressions ana their Computation by Machine»" C2mmy.nic.tt jc«Bs. gf j|j$

45

Page 51: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

w—r 1

[Mc Der mot

CMoon743

CNaur603

[Normanfc9

CParsuns7

CRAPIDATA

CReiser75

CReiser76

CRieger76

CSa»et763

ZSi klo s sy

CSmith703

t7£D McDermott, t. V. and Sussman, 6. J. "The Connivtr Reference Manual«" AI Me«,o Ko. 25<J, MIT Project MAC t f..y 1972.

Moon, O.A. "MACLISP keference Manual," Project MAC Massachusetts Institute of Technology, Cambrioce, Massachusetts, 1974.

Naur, P. (tditor). "Revised Report on the Algorithmic Language ALUOL 60," C.o.8gu.nic.aiions fif jhe ACM, May 1960, pp.

J Norman, t. "LISP," University of Wisconsin Computing Center, ri I Madison, Wisconsin, Apt 1969.

43 Parsons, F. G., Dale, A. &. Manipulation Language Rtquirements for Dataoas Management Systems," Computer Journal, May 1974, pp 99-103.

and Yurkanan, Rtquirements

C . V . " D a t a for Dataoase

RAPIOATA Corporation. "A FORTRAN DMl DBMS-1ÜV* Fairfield, New Jersey.

Implementation fur

Reiser, J. F. "BAIL—A debugger for SAIL," Stanford Artificial Intelligence Laboratory, Memo AIM-27C, Octouer 1975.

3 Reiser, J. F. (Editor). "SAIL," Stanford Artificial Intelligence Laboratory, Memo AIM-289, August 1976.

j Rieger, C.J. "Spontaneous Computation in Cognitive Moaels," Department of Computer Science, University of Marylanc, TR-459, July 1976.

Samet, h. "The SAIL Data Base Management Science Department, University of Park, Maryland, Unpublished, 1976.

System," Computer Maryland, College

763 Siklossy, L. kfill« Hi*. LlSEt Prentice-Hall, Inc., 1976.

Smith, D. C. "MLISP," Stanford Artificial intelligence Project, Memo AIM-135, 1970.

CStacey743 Stacey, b. M. "A FORTRAN Interface to the CODASYL DataDase Task uroup Specifications," Computer Journal, May 1974, po. 124-129.

CSussman7

CTaylor76

CTeiteIma

CT0PS103

CWeissman

CUilcox76

i.2 Sussman, o., Minograd, T., and Charniak, E.» "MICROPLANNER Reference Manual," M.I.T. AI-TR-203a, !??1

j Taylor, R. w. and Frank, R. L. "CODASYL Data-Base Management Systems," A£M CeiBüIiDä iUEX£Y.3» March 1976, pp. 67-1Ci.

n743 Teltelman, w. "INTERLISP Reference Manual." XEPOX Palo Alto Research Center, Palo Alto, California, 1974.

DEC. "DECSYSTEM-10 Operating Systems Command Manual," DEC-10-OSCMA-A-D, Digital Equipment Corporation, Maynard, Massachusetts, May 1974

673 rfeissman, C. "LISP 1.5 Primer," Dickinson Publishing Company, 1967.

j wilcox. C. R. "MAINSAIL Language Manual," SUMEX, Stanforc University, May 1976.

46

HbaHiM tfte^dka^ •a^a. #..**••

Page 52: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

wmmmmmmmmmmmmBM^Bmm

8. Suamary Chart

i i

IfKif! 2Ö

RS* S

s :sziSm:

if

i

* -*• • -- •• a - ii •- -.«. • -e t J--»- c

a»* - »a*-- ••

w • e ~ *•• *•- *- »«y-S «• - ' M • * ~ -C*-•*

itSiii

a:

3

: 2

i 5 mt # i

H

at.' • MC* *

t •1

:

i i

«I

a :m

3 fit 5 K* .•-: = Si» I

=•»

• *«•-* Z'.Zi

:.t

1 I

i i X

I. i

i tin i-r-t

I i

IS • • H

T5 : « - -• tu: ifii

B 1 i Ellis

! I

-•».-» j • •

Si.:: . rtii .•s.t.s i*::

*. •> k mm 9 * -*.

•=:::;. tisi

Sit*;;* risst :;:;rtl

ts I

t:

:t

1

47

Page 53: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

UNCLASSIFIED SECURITY CLASSIFICATION OF THIS PACE (Whit Dot» Entered;

REPORT DOCUMENTATION PAGE I. REPORT NUMBER 2. COVT ACCESSION NO

TITLE fand Subtitle)

C4J Artificial Intelligence Programming Languages for Computer Aided Manufacturing^

READ INSTRUCTIONS BEFORE COMPLETING KORM

3. RECIPIENT'S CATALOG NUMBER

»• -TYPE OF REPORT | PERIOD COVERED

/Technical AaJtoS^"» 1 P»ffFf»»"'"p ORS. REPORT NUMBER

TR-595

S. PERFORMING ORGANIZATION NAME AND AOORESS

Computer Science Dept. Univ. of Maryland College Park. Md. 20742

II. CONTROLLING OFFICE NAME ANO ADDRESS

Informations Systems Branch Office of Naval Research Wash., P.C. 20305

M- MONITORING AGENCY NAME • AOORESSf" dlttotont San Controlling Office;

10. PROGRAM ELEMENT, PROJECT, TASK AREA « WORK UNIT NUMBERS

12. REPOR

»<-»77 ) Sep NUMBER • PAGES

47 IS. SECURITY CLASS, (ol thlt r.pb

Unclassified

Tw DECLASSIFICATION/ DOWNGRADING SCHEDULE

I*. DISTRIBUTION STATEMENT (ol Oil» R.porfj

Approved for public release; distribution unlimited.

17. DISTRIBUTION STATEMENT (ol fne ebetrac« entered In Block 30, It d/fferenf from Report;

I». SUPPLEMENTARY NOTES

It. KEY WOROS 'Continue on revere* efrfe II neceeeary ana Idontlty by block number;

Hkm E

Artificial Intelligence Programming Languages Computer Aided Manufacturing

Systems Control

10. AfcfTRACT (Conllnu* on rovott» »Id» It neeeeewy and Idontlty by block number;

ight Artificial Intelligence programming languages (SAIL, LISP, MICROPLANNER, C0NNIVER, MLISP, P0P-2, AL and QLISP) are presented and surveyed, with examples of'their use in an automated shop environment. Control structures are compared, and distinctive features of each language are highlighted. A simple programming task is used to Illustrate programs in SAIL, LISP, MICROPLANNER and C0NNIVER. The report assumes reader knowledge of programming concepts, but not necessarily of the languages surveyed.

DO,: *\Tn 1473 EOl'iiON OF I NOVSS IS OBSOLETE s cuf

J LttJiOiSSIIIffl.

SECURITY CLASSIFICATION OF TM

am

am THIS PAGSfr

0(^ik ^ fMien Der* enter«/;

. *.

Page 54: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer

'• H mtf r T

Off of Naval Research Branch Office, Boston 495 Summer St. Boston, Mass. 02210

New York Area Office 715 Broadway-5th Floor New York, N.Y. 10003

Mr. E. H. Gleissner Naval Ship R+D Center Computation and Math Department Code 18 Bethesda, Maryland 20084

Capt. Grace M. Hopper NAICOM/MIS Planning Branch OP-916D Off, Chf. of Naval Op. Washington, D.C. 20350

Mr. Kin B. Thompson Technical Director Information Systems Div. 0P-91T Off., Chf. of Naval Op. Washington, D.C. 20375

Naval Research Lab. Technical Info. Division Code 2627 Washington, D.C. 20375

Dr. A.L. Slafkosky Scientific Advisor Commandant, USMC Code RD-1 Washington, D.C. 20380

National Security Agcy. Attn: Dr. Maar Fort Meade, Maryland 20755

Off. of Naval Research Code 1021P Arlington, Va. 22217

Asst. Chief for Tech. ONR Dept. of Navy Code 200 Arlington, Va. 22217

Off. of Naval Research Information Sys. Program Code 437 Arlington, Va. 22217

Off. of Naval Research Code 455 Arlington, Va. 22217

Off. of Naval Research Code 458 Arlington, Va. 22217

Defense Documenta. Cent. Cameron Station Alexandria, Va. 22314

Off. of Naval Research Branch Office, Chicago 536 South Clark St. Chicago, 111. 60605

Off. of Naval Research Branch Off., Pasadena 1030 East Green St. Pasadena, Calif. 91106

Naval Electron. Lab. Ctr. Adv. Software Tech. Div. Code 5200 San Diego, Calif. 92152

tm .—.

Page 55: AD-A047 179 MARYLAND UNIV COLLEGE PARK DEPT OF … · ad-a047 179 maryland univ college park dept of computer science f/0 9/2 artificial intelligence pr09rammin9 lan0ua9es for computer