ResearchsupportedbyONRContractN00014-91-J-4052,ARPAOrder8225.



Similar documents

Address Taken FIAlias, which is equivalent to Steensgaard. CS553 Lecture Alias Analysis II 2

DECLARATION OF PERFORMANCE NO. HU-DOP_TN _001

Statistics 100A Homework 7 Solutions


Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80)


CS473 - Algorithms I

The Exponential Distribution

INTERNATIONAL UNIVERSITY COLLABORATION CENTRE

14. Nonlinear least-squares

VERTICES OF GIVEN DEGREE IN SERIES-PARALLEL GRAPHS

MyOWNMcMaster Degree Pathway: Diploma in Business Administration & Bachelor of Arts in History

Manual for SOA Exam MLC.

Requirements The MyOWNMcMaster degree pathway has three parts: diploma, elective and undergraduate courses.

The MyOWNMcMaster degree pathway has three parts: diploma, elective and undergraduate courses.

Real-time Streaming Analysis for Hadoop and Flume. Aaron Kimball odiago, inc. OSCON Data 2011

Solving Systems of Linear Equations


FUNCTIONAL PROGRAMMING

Table of Contents. This file contains the following documents in the order Fsted:

Lecture 22: C Programming 4 Embedded Systems

INTEGRATING FACTOR METHOD

Algebraic Structures II

Mathematical Expectation

A Uniform Asymptotic Estimate for Discounted Aggregate Claims with Subexponential Tails

Figure2:Themixtureoffactoranalysisgenerativemodel. j;j z

Portfolio Distribution Modelling and Computation. Harry Zheng Department of Mathematics Imperial College

M/M/1 and M/M/m Queueing Systems


Printing Letters Correctly

1 Interest rates, and risk-free investments

SF2940: Probability theory Lecture 8: Multivariate Normal Distribution

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 14 10/27/2008 MOMENT GENERATING FUNCTIONS

Architectural Analysis of Microsoft Dynamics NAV

Optimization of a Combined Heat and Power Generation System with Ice Thermal Storage

Manual for SOA Exam MLC.

A SNOWBALL CURRENCY OPTION

Uncertainty evaluations in EMC measurements

SQL Programming. CS145 Lecture Notes #10. Motivation. Oracle PL/SQL. Basics. Example schema:

C Programming. Charudatt Kadolkar. IIT Guwahati. C Programming p.1/34

In order to master the techniques explained here it is vital that you undertake plenty of practice exercises so that they become second nature.

Applying Active Noise Control Technique for Augmented Reality Headphones

r + s = i + j (q + t)n; 2 rs = ij (qj + ti)n + qtn.

MATH 381 HOMEWORK 2 SOLUTIONS

Statistics 100A Homework 8 Solutions

CS 241 Data Organization Coding Standards

Practice problems for Homework 11 - Point Estimation

TN No. ~,' 79n. (BPDl Revision: HCFA-PM DECEMBER 1991 State/Territory: (a)

Chapter 7D The Java Virtual Machine

E2E Project Management Process Governance (Electric Capital)

Probability density function : An arbitrary continuous random variable X is similarly described by its probability density function f x = f X

Permanents, Order Statistics, Outliers, and Robustness

Vectors and Index Notation

On closed-form solutions of a resource allocation problem in parallel funding of R&D projects

( ) = 1 x. ! 2x = 2. The region where that joint density is positive is indicated with dotted lines in the graph below. y = x

SOLVING LINEAR SYSTEMS

COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms.

Master s Theory Exam Spring 2006

... Schema Integration

TRANSACTIONS JUNE, 1969 AN UPPER BOUND ON THE STOP-LOSS NET PREMIUM--ACTUARIAL NOTE NEWTON L. BOWERS, JR. ABSTRACT

x 3 x 4 x 2 f Site A Site B Site C

SF2940: Probability theory Lecture 8: Multivariate Normal Distribution

Modelling Patient Flow in an Emergency Department

Probability Distribution for Discrete Random Variables

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015

A mixture model for random graphs

3. The Economics of Insurance

Hook Lengths and Contents. Richard P. Stanley M.I.T.

Mathematics of Life Contingencies MATH 3281

1. Use the class definition above to circle and identify the parts of code from the list given in parts a j.

Eigenvalues and Eigenvectors

Statistics 100A Homework 3 Solutions

8. Matchings and Factors

STAT 830 Convergence in Distribution

RANDOM VARIABLES AND PROBABILITY DISTRIBUTIONS

We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded

telnetd exploit FreeBSD Telnetd Remote Exploit Für Compass Security AG Öffentliche Version 1.0 Januar 2012

Improving Experiments by Optimal Blocking: Minimizing the Maximum Within-block Distance

LAB : PAPER PET GENETICS. male (hat) female (hair bow) Skin color green or orange Eyes round or square Nose triangle or oval Teeth pointed or square

Transcription:

FunctionalProgrammingFormalisms GerdHillebrand,ParisKanellakis, DepartmentofComputerScience Providence,RhodeIsland02912 andsridharramaswamy foroodbmethods BrownUniversity CS-94-28 May1994

BrownUniversity,Providence,RI02912,U.S.A. foroodbmethods GerdHillebrand,ParisKanellakis,andSridharRamaswamy FunctionalProgrammingFormalisms minglanguagesare(1)applicativeprogramschemasand(2)typedlambda (OODBs)andinparticulartothedescriptionofmethods. calculi.werelatetheseprogrammingformalismstoobject-orienteddatabases Abstract.Twowell-studiedfunctionalformalismsinthetheoryofprogram- databasesisptime. classes,methods,inheritance,nameoverloading,andlatebinding.from[4],we databasequerylanguagesbyshowingthatitsexpressivepoweroverniteordered applicativeprogramschemaswithadditionalkeyobject-orientedfeaturessuchas presentitssyntaxandsemanticsandsurveythestate-of-the-artofconsistency studyingdatabaseschemaevolution.wethenrelatemswithmoreconventional checkingorsignatureinferenceforthislanguage,aproblemwhichcanbeusedin Despiteitssimplicityandapplicability,MSdoesnotdirectlymodelthetuple, Thelanguageofmethodschemas(MS)isaprogrammingformalismbasedon set,andlistcomplexstructuresthatarequitecommonindatabases.also,it calculus/algebra,datalog(withorwithoutnegation),andthecomplexobject doesnottreatfunctionsasobjects,i.e.,methodsaredierentfromobjects.it ispossibletoachievethesetwocapabilitiesusingthetypedlambdacalculus subsumesmostconventionaldatabasequerylanguagesincludingtherelational withequality(tlc=)asadatabasequerylanguage,evenwithoutanyobjectorientedfeatures.from[25],weillustratehowthispurefunctionallanguage calculus/algebra(withorwithoutpowerset). withtheexpressivetlc=andfacilitatesoperationsonsetsofobjects. OODBsmustbeafunctionallanguagethatcombinestheobject-orientedMS 1Introduction Object-orienteddatabases(OODBs)representanewgenerationofdatabase technology,whichhasdevelopedthroughacombinationofadvancedprogramminglanguagefeaturesandsuccessfulrelational/networkdatabasetechniques, see[9,30,44].bothprogramminglanguagetheoryanddatabasetheoryhave Inconclusion,wearguethattheappropriateprogrammingformalismfor ResearchsupportedbyONRContractN00014-91-J-4052,ARPAOrder8225.

2beenproposedasstartingpointsforOODBformalfoundations.Theyareboth legitimatestartingpoints,butoneshouldbeawarethatanaivesynthesisofsuch questionhowtomatchdistinctprogrammingparadigmsinonelanguage. foroodbs"fromafunctionalperspective.weviewtheorganizationofdata distincttheoriesisnotnecessarilyharmonious.forexample,itislargelyanopen Inthispaperweexploretheproblem\whatistheappropriateformalmodel GerdHillebrand,ParisKanellakis,andSridharRamaswamy intoobjectswithmethodsasthecorenewfeatureofoodbs.thisisafunctioncentric(ormethod-centric)viewofdataasopposedtothestructure-centricview ofdatainrelationaldatabases(e.g.,in[28,41]). Becauseofthefunction-centriccharacterofOODBswebelievethatthisisoneof advocatedinthepast,e.g.,[15,38],butmuchremainstobedoneinthisarea. themostpromisingapproachestotheproblemoftheirformalization.notethat someoftheactualquerylanguagesinoodbprototypesarefunctional[9]and thatrecentresearchoncomplex-objectsandtypeshasemphasizedfunctional models[13,14]. Interestingfunctionalapproachestodatabasequerylanguageshavebeen anoodbformalismcalledmethodschemas(ms)in[4].weshowthatmethod schemas(overordereddatabases)expressexactlytheptimequeries.(2)we culi[19,11,12].werelatethesetwoprogrammingformalismstooodbsand inparticulartothedescriptionofoodbmethods. guagesare(1)applicativeprogramschemas[21,23]and(2)typedlambdacal- presentthetypedlambdacalculusasaformalismforexpressingawiderangeof relationalandcomplex-objectdatabasequeries[25].inthiscase,theelementary Inordertoaccomplishthis:(1)Wemodifyapplicativeprogramschemasinto Twowell-studiedfunctionalformalismsinthetheoryofprogramminglan- timequeries(whichproperlycontaintheptimequeries)areexpressible,becauseofalimitedabilitytocreateandmanipulateliststructures.so,interms themoreconvenient)framework. ofexpressivepower,thetypedlambdacalculusisthemoregeneral(evenifnot andsemanticsofmethodschemasandmotivatethemwithanoodbexample.methodschemaconsistencyisaformof\typeinference,"whichinvolves nameoverloading,andlatebinding.insection2.1,weexplainthesyntax programschemaswithadditionalfeaturessuchasclasses,methods,inheritance, generality,inpurefunctionalform.morespecically,weproceedasfollows. oftheexpressivepowerofmethodschemaswedemonstratehowmanynotions fromrelationalandobject-orienteddatabasescanbeformulated,withnolossof MSisasimpleprogrammingformalismforOODBs,basedonapplicative Byouroverviewoftheapproachesin[4,25]andournewcharacterization state-of-the-artonconsistencychecking.weusevariousalgorithmictechniques andtechniquesfromthetheoryofprogramschemas,e.g.,[8,33]. schemaevolutionproblem[4,10,26,39,43,45].insection2.2,wesurveythe checkingformethodschemasisanalgorithmicformalizationofthedatabase consistencyatrun-timeinsomeinterpretation.amoreprecisetermforthis problemwouldbesignatureinference.theincrementalversionofconsistency decidingatcompile-timewhetheragivenmethodschemacanleadtoanin- InSection3,weexaminetheexpressivepowerofMSbyrelatingittothemore

functionalcharacterizationintermsofequationsispresentedin[24].notealso ofptime(analogoustothelogicalcharacterizationsof[27,42]).adierent that,datalogwithnegationhasbeenusedin[5]toprovidesemanticstoanumber ofvariationsofmethodschemas.insection3.1weoutlinetheinput-output 31,6].Forniteorderedinterpretationsthisisafunctionalcharacterization conventionalformalismsofrelationalcalculus[20]anddatalogwithnegation[18, FunctionalProgrammingFormalismsforOODBMethods 3 conventions,insection3.2wearguethateveryptimequeryisexpressible, Datalog,complexstructures(suchassets,tuplesorlists)arenotdirectlypartof andinsection3.3thatonlyptimequeriesareexpressible. theframeworkbuthavetobeencoded(intorelationsfordatalog,intotheclass functionalframeworkbutdonottreatfunctionsasobjects,i.e.,methodsare dierentfromobjects.toachievethisuniformityonehastoexaminehigherorderframeworksrelatedtothelambdacalculus.anotherproblemisthat,asin somedisadvantages,however.methodschemasareanexampleofapractical itincorporatesmanyadditionaldesirableobject-orientedfeatures.thereare theveryrobustconceptofptimedatabasequeriesthatisattractivebecause OurexpressivepowerresultindicatesthatMSisasyntacticvariationon semantics,andthetypesofthesimplytypedlambdacalculuswithequality notionoftypeshereisstructuralandquitedierentfromthenotionofclasses. (TLC=).Wereferto[25]forhowtoremoveequalityfromthiscalculus.Forthe hierarchyandmethodsforms).intypedlambdacalculiwecanuseasimple typedisciplinetoencodecomplexstructuresinafarmoredirectfashion.the problemoftypeinferencewereferto[29]. manydatabasequerylanguagesincludingtherelationalcalculus/algebra[20], lus/algebra(withorwithoutpowerset)[1,3].weconsiderembeddingssuch Datalog(withorwithoutnegation)[18,31,6],andthecomplexobjectcalcu- thatforeachqueryexpressedthereisalambdatermwhichwhenappliedtothe InSection4,wepresentsomebasicbackgroundonthesyntax,theoperational inputdatabase. database;mostimportantly,ifthequeryexpressedisinptimethenthenormal formcanbecomputedinanumberofreductionstepspolynomialinthesizeof inputdatabase(whichisalist-of-tupleslambdaterm)normalizestotheoutput Itispossibleto\naturallyembed"inthetypedlambdacalculuswithequality basedontheanalysisofreductionsequencesof[40,34]. tuplesandlists,aswellastheimportantconceptoflistiteration.insection5.2 wepresent,asanextendedexample,theembeddingoftherelationalalgebra. Ouranalysisoftheexpressivepowerofthesimplytypedlambdacalculusis languagetypesystems,i.e.,onlysimpletypeswithoutanypolymorphism.itis thatthesefeaturesallowtheembeddingofhigher-orderqueries,e.g.,thesecondorderqueriesof[22,17].notethatweonlyusetheverycoreofprogramming InSection5.1wediscusstheinput-outputconventionsforrepresentingsets, of[25]inthetypedlambdacalculus. schemasandtheirrecursivedenitioncanallbesimulatedusingthexpoints interestingthatthe(otherwiseveryconvenient)useofmethodnamesinmethod Wereferto[25]forthemoreadvancedxpointandpowersetfeatures.Note Theembeddingswepresentformtherststepinunderstandingtheconnec-

4PTIMEquerieswepresenthereamethodschemaframework(Section3)andthe characterizationsofptimewereferto[24,32]. databasetheoryoneciency,wecanrestrictourselvestoptimequeries.for tionsbetweenfunctionalprogramminganddatabases.giventheemphasisof basisforalambdacalculusframework(section5and[25]).forotherfunctional Inconclusion,inSection6wecommentonthepossiblecombinationofMS GerdHillebrand,ParisKanellakis,andSridharRamaswamy withtlc=aswellassomeopenresearchquestions. Weassumetheexistenceofthefollowingdisjointcountablesetsofsymbols: 2MethodSchemas(MS) 2.1SyntaxandOperationalSemantics ofclasses(c1;c2;:::)andofmethods(m1;m2;:::).foreachmethodm,the arityofmisanintegergreaterorequaltozero.asignatureisanexpression (butsincetheword\type"hasbeenmisusedinmanydierentcontextswe expressionis!c1.inthisformalismthesignaturesplaytheroleof\types" c1;:::;ck 1!ck,whereeachci,for1ik,isaclass.Fork=1,the prefertousethemoreprecisetermsignature). integerinf1;:::;kg;(2)eachvertexlabeledbyamethodofarityjhasjchildren fork1isatriple(m;(c1;:::;ck);t),wheremisamethodofarityk,for 1ik,eachciisaclass,andtisak-term(i.e.,k-termsareourprogramming (Fork=1,themethodmiszero-ary.)Acodeddenitionofmatc1;:::;ck, (dag)suchthat:(1)eachvertexisuniquelylabeledeitherbyamethodorbyan formalism). ck)),wheremisamethodofarityk 1andtheremainingpartisasignature. Ak-termforsomek1isaniterootedordereddirectedacyclicgraph Abasedenitionofmatc1;:::;ck 1,fork1isapair(m;(c1;:::;ck 1! nition,also2-terms,3-terms,etc.theideaisthatk-termsrepresentfunctions ofkarguments,whereacopyofargumentiisplacedateachinputlabeledi. goingfromlefttorightbecausethechildrenofeachvertexareordered. theyareconstantinputs. Verticescanalsohaveoutdegreezeroandbelabeledbyzero-arymethods,i.e., inputsandeachvertexlabeledwithanintegerisaninput;(4)therootiscalled theoutput;(5)thedagcomeswithauniquelydeneddepthrstsearchorder whichareorderedfromlefttoright;(3)allverticesofout-degreezeroarecalled Forexample,thetermstandt0inFigure1are1-terms.Theyare,byde- LetsbeasinglearcwithtaillabeledPriceandheadlabeled1,andtbeasin Figure1.Thesedenitionscanberepresentedsyntacticallyusinganintuitive Asanexample,considerthefollowingdenitions: lambdanotation insteadofthegraphicalk-termnotation asshownbelow. (Cost;(Part);t) (Cost;(Basepart);s) (Price;(Basepart!Int))

FunctionalProgrammingFormalismsforOODBMethods Assemblingcost \\\\\ ZZZZ SumCost 5 ZZZZ ZZZZ 1Subparts Head CostSum 1Cost Notethatweusethesymbolcolon(:)forrepresentingbasemethodsandthe Fig.1.Termtandt0 Tail symbolequal(=)forcodedmethods. Denition1.Amethodschemaisa4-tuple(C;;0;1)where: 1.CisanitesetofclassesandisaforestonC.Wesaythatcc0ifcisa Price@Basepart:Int Cost@Basepart=x:Price(x) 3.1isasetofcodeddenitionswithclassesfromC.LetM0bethesetof 2.0isasetofbasedenitionswithclassesfromC. descendantofc0inthisforest.thepartialorderdenedbyiscalledthe Isarelation. Cost@Part=x:Sum(Assemblingcost(x);Cost(Subparts(x))) Figure1.MethoddenitionsarepresentedinFigure3. Example1.ConsidertheclasshierarchyofFigure2andthetermstandt0in 4.Eachmethodofaritykhasatmostonedenitionatc1;:::;ckforeach of1arefromm0[m1. requirethatm0\m1=;andthatthemethodsthatappearink-terms c1;:::;ck. methodsdenedin0andm1bethesetofmethodsdenedin1.we Fig.2.AnexampleIsahierarchy IntBasepart Part HHHH CompPart PairOfParts schemas. Letusbrieysurveysomeimportantconceptsinconnectionwithmethod

6Head Tail Price Sum @PairOfParts:Part @Basepart:Int @Int;Int:Int GerdHillebrand,ParisKanellakis,andSridharRamaswamy Fig.3.Methods Assemblingcost@Part Cost Subparts @Basepart=x:Price(x) @PairOfParts=t0 :PairOfParts allitsmethodshavearity1.aschemaisrecursion-freeifthereisnodirected dencegrapharethecodedmethodsandthereisanarcfrommtonimoccurs Notethatsimpleschemasareanimportantkindofrecursion-freeschemas. isareasonablesyntacticwayofavoidingrecursion,butnotnecessarilytheonly cycleinthemethoddependencegraph,wheretheverticesofthemethoddepen- one.)aschemaissimpleifonlybasemethodsoccurinitscodeddenitions. insomecodeddenitionofn.(notethat,ourdenitionofrecursion-freeness Syntacticallyrestrictedfamiliesofmethodschemas:Aschemaismonadicif ofbasemethods.asimpleschemaiscovariantifforeachmandforeachpair methods,i.e.,0;1,whichwecallexplicit.itisalsousedtodenemethods ofdenitionsofabasemethodm,wehavethat(8ic0ici))c0c. Forsimpleschemas,covarianceisthefollowingconstraintonthesignatures implicitly,throughinheritance.thisisfortheconvenienceofcodereuse.therefore,inadditiontotheexplicitdenitionsforamethod,denitionsareimplicitly MethodInheritance:Amethodschema(C;;0;1)containsdenitionsof (m;(c01;:::;c0k!c0)) (m;(c1;:::;ck!c)); c01;:::;c0k,thenitsdenitionimplicitlyappliesatc1;:::;ckwherecic0ifor i=1;:::;k. inheritedalongtheclasshierarchy.ifamethodmisexplicitlydenedatclasses itisalsoexplicitlydenedforpairofparts. andgivenclasses,auniquedenition.theresolutionofamethodmatsome itlyinheritedbybasepartandcomppart,andexplicitlyredenedonbasepart; methodcostintheexample.thatmethodisexplicitlydenedonpart,implic- condition4ofthemethodschemadenitiontherecanbeonlyoneexplicitdenition.thiscreatesoverloadingofnames.toillustrateoverloading,considerthinitionsforthesamebaseorcodedmethodatthesameclasses althoughby Resolutionofnameoverloading:Thisconsistsofassigningtoagivenmethod Nameoverloading:Methodinheritanceimpliesthatwecanhaveseveraldef-

(ifsuchauniquecomponent-wiseminimumexists).forexample,costat c1;:::;ckistheexplicitdenitionofmforthe\component-wisesmallest"tuple CompPartisresolvedtobetheexplicitdenitionfromPart,whereasCostat BasepartisBasepart'sexplicitdenition.Ifmhasaresolutionatc1;:::;ck,we c01;:::;c0katwhichmhasanexplicitdenitionandcic0i,fori=1;:::;k saythatmiswelldenedatc1;:::;ck.otherwise,wesaythatmisundenedat FunctionalProgrammingFormalismsforOODBMethods 7 denition)andmisundenedatc1;c1(ambiguityofdenitions).formethods explicitbasedenitionsofmatc1;c2andc2;c1.thenmisundenedatc2;c2(no ofarity1,ambiguity(2)cannotarisebecauseoftheforesthierarchy,butwecan Example2.Letc1;c2beclasseswithc1c2andconsidertheschemawith havenon-denitionbecauseof(1). abovec1;:::;ckor(2)becausethereisambiguityofdenitionsabovec1;:::;ck. c1;:::;ck.non-denitioncancomeeither(1)becausethereisnodenitionofm classesaremappedtodisjointsetsofobjects(setswithpairwiseemptyintersections).foreachc,wedene(c)=sc1c(c1).wewillrefertosc2c(c)as (;)whereisadisjointobjectassignmentforcandatotalfunctionfrom thebasemethodsm0instopartialfunctionssuchthat: 1.Ifmhasarityk,(m)isapartialfunctionfromk-tuplesofobjectsinto mentforcisatotalfunctionfromctonitesetsofobjectssuchthatdistinct ments[2]toprovidesemanticsforclasseswithinheritance.thesemanticsof basemethodsisdenedusingpartialfunctionssatisfyingcertainsignatureconstraints. Denition2.Givenamethodschema(C;;0;1),adisjointobjectassign- objects(o1;o2;:::)disjointfromclassesandmethods.weuseobjectassign- Objectassignments:Weassumetheexistenceofacountablyinnitesetof thesetofobjectsin. Denition3.AninterpretationofaschemaS=(C;;0;1)isapairI= toits\subclasses"c1,wherec1candc16=c.whenabasemethodisdened areinthisclassexclusively(thoseobjectsthatarein(c))andtherestbelong 2.Foreachc1;:::;ck,ifmisundenedatc1;:::;ck,then(m)isundened Intuitively,everyclasscispopulatedbyasetofobjects(c),someofwhich havethat(m)j(c1)(ck)isatotalfunctioninto(c). everywherein(c1)(ck).otherwise,lettheresolutionofmat c1;:::;ckbe(m;(c01;:::;c0k!c))wherecic0ifori=1;:::;k.thenwe objectsin. equivalenttofunctioncomposition. Thatis,givenanobjectexclusivelyinc1,returnanobjectinc. basemethodsandarewritingtechnique.withoutrecursion,thisrewritingis ataclassc1withsignaturec1!c(orisinheritedatc1withsignaturec01!c suchthatc1c01),thenitsmeaningatc1isatotalfunctionfrom(c1)to(c). Thesemanticsofcodedmethodsisdenedusingtheabovesemanticsof

bereplacedbyanobjecto,asa\procedurecall"tocost.basedontheclassof abase/codedfashion,orbyanerrormessageifitisundened.ingeneral,we termthatisasinglearc.letitsoneinternalnodebelabeledcostanditsinput 8itsargument,wecanreplaceCosteitherbysomeobject/codeifitisdenedin usrstgivesomeintuitionfortherewritingofcodedmethods.considerak- Latebinding:Thisisaresultoftheoperationaldenitionofrewriting.Let GerdHillebrand,ParisKanellakis,andSridharRamaswamy reducetherstmethod(rstinthedepthrstorderingofthek-termweare processing)thathasinstantiatedleavesaschildren.wecontinuethisprocessing untilweeitherobtainaresult(i.e.,anobject),orreachaninconsistency.we mightalsonotterminate.apartialsequenceofrewritingsforexample1is showninfigure4,whereoisinclasspairofpartsando0;o00areinclassbasepart. CostCostCostCostCostPriceCost17Cost17Cost??????? JJ^ Sum @@R Sum @@R? Sum @@R? Sum @@R? Sum @@R whoseintegerlabelshavebeenreplacedbyobjects.letc1;:::;ckbeclasses, Fig.4.Areductionsequence oheadtailo0tailo0tail Moreformally,aninstantiatedtermininterpretationI=(;)isak-term, o o o Tail o o00? termconsistingofasinglevertexlabeledmandkinputslabeledrespectively mbeamethodofarityk,andforeachiletoi2(ci).thentheinstantiated c1;:::;ck.thereductioni(t)oftiniisobtainedasfollows: Leto1;:::;okbethelabelsofthechildrenofwbelongingrespectivelytoclasses tiatedtermini,wbetherstreduciblevertexoft,andmbethelabelofw. term,whichistherootofaredex. Denition4.LetIbeaninterpretationofmethodschemaS,tbeaninstan- o1;:::;okissaidtobearedex.wedenetherstreduciblevertextobethe uniquelydeterminedrstvertexinthedepthrstorderingofaninstantiated 2.Ifmisabasemethodwelldenedatc1;:::;ck,letitsresolutiontherebe 1.Ifmisundenedatc1;:::;ckthenI(t)isaspecialsymbol?. istheinstantiatedtermobtainedbyremovingfromwtheoutgoingedges (m;(c01;:::;c0k!c)).(thisimpliesthatcic0ifori=1;:::;k.)theni(t) t!i(t)andanitesequenceofreductionsfromttot0ast!t0. 3.Ifmisacodedmethodwelldenedatc1;:::;ck,thenI(t)istheinstantiated WhenIisclearfromthecontext,wedenotethereductionofttoI(t)as andchangingitslabelto(m)(o1;:::;ok).(m)isatotalfunctionfrom (c1)(ck)into(c).therefore,(m)(o1;:::;ok)yieldsanobjecto suchthato2(c). termobtainedbysubstituting,withthenaturalrenamingofinputs,the vertexwbythedags,where(m;;s)istheresolutionofmatc1;:::;ck.

ofaritykwelldenedattheseclasses,andforeachiletoi2(ci).thenthe 2.2ConsistencyandSignatureInference Weareinterestedintherewritingsequencesofaparticularsetofinstantiated schemawithinterpretationi=(;),c1;:::;ckbeclassesins,mamethod terms,i.e.,thesearetheinitial\procedurecalls"thatmakesenseaccordingto amethodschema.moreformallywehavethefollowing:letsbeamethod FunctionalProgrammingFormalismsforOODBMethods 9 Denition5.AmethodschemaSisconsistentifforeachinterpretationIofS itisimpossibletorewriteanystart-redexinto?inanitenumberofsteps. ifforsomestart-redextwehavet!?. respectivelyo1;:::;okissaidtobeastart-redex.wehaveaninconsistencyini instantiatedtermconsistingofasinglevertexlabeledmandkinputslabeled sistent?(2)aretherepossible/certaindivergingcomputations?(3)ismethodm on(1)althoughmostofthetechniquesthatwedevelopcanbeusedforstudying monadicarityandabsenceofrecursion. otherproblemssuchas(2)or(3).twopropertiessimplifyconsistencychecking: (atc)possibly/certainly\reachable"fromm0(atc0)[26]?weconcentratehere odseachtimetheschemaisupdated.theproblemistoobtainanincremen- talconsistencycheckingalgorithmthatwouldavoidredoingthesameveri- cations/computations.asolutionthatisadoptedpractically(e.g.,[9])isto Inanobject-orientedcontext,itisnotreasonabletorecompileallmeth- Avarietyofquestionsareimportantinthissetting,e.g.:(1)Isaschemacon- beaectedisthecrucialpart.webrieysummarizesomeresultsfrom[4](on whatmaybeaected)andsomeopenquestions.letnbethesizeofmethod maintainadependencygraphofthemethodsandrecompileonlymethodsthat mayhavebeenaectedbytheupdate.ofcourse,understandingwhatmay denitionsintheinputmethodschemaandcthesizeoftheclasshierarchy. Bothpolyadicmethodsandrecursionarenecessaryforthisresult.Theproofis byreductionfromresultsin[33].thisundecidabilityresultholdsforschemas withmethodsofaritylessthanorequalto3.thedecidabilityofmethodschema consistencywithmethodsofarity2isopen. Inthegeneralcaseofpolyadicrecursiveschemas,consistencyisundecidable. Onecanfocusonthekeyrecursion-freecaseofasinglecodedmethodinthe forconsistencyislogspace-completeinptime.thisindicatesthatveryecient incrementalsolutionsforeventhesimplestsyntacticcasesmaybehardtoobtain. decisionprocedurerunsino(nc3)time. Tohandleoverloading,onecanuseamodicationofatechniqueof[8].The thislanguagehasanon-emptyintersectionwithaparticularregularlanguage. describedusingacontext-freelanguage.aninconsistencymaybereachedif Inthecaseofmonadicandrecursion-freeschemas,checkingawholeschema Inthecaseofmonadicschemas,thesetofpossiblecomputationscanbe logspace-completeinnlogspaceandcanbedonemoreecientlythanthe recursivecaseaboveusingnitestateautomatatechniques(ino(nc2)time). Inheritanceandoverloadingintroducesomenondeterminismintheautomata contextofbasemethods.checkingasinglecodedmethodforconsistencyis

consistencyofmonadic,covariant,recursion-freeschemas.wealsodonotknow notknowwhetherthisradix-treedatastructurecanbeextendedtosolvethe whetherthereareecientincrementalalgorithmsforanyoftheconsistency 10 andcanbecheckedino(n+c)timeusingaradix-treedatastructure.wedo theoreticapproachtoconsistencychecking,butcovariantsignaturesremoveit. Consistencyofasinglecodedmethod,assumingcovariance,isinDLOGSPACE GerdHillebrand,ParisKanellakis,andSridharRamaswamy problems.sinceweknowthattheproblemofconsistencycheckingformonadic, recursion-freeschemasisptime-complete,itwouldbeinterestingtoknowif therearegoodincrementalalgorithmsforthesimple,monadicorthecovariant, monadiccases. completeforasinglecodedmethodwithtwoarguments.somespecialcases doesnothelpintherecursivecase.however,intherecursion-freecovariantcase thereisaptimetestforaxedaritycodedmethod.thisisinterestingin canbeshowntobeinptime,usingtreeautomatatechniques.covariance practice,becauseitmotivatesaheuristicforthegeneralcase. Inthecaseofrecursion-freeschemas,theconsistencyproblemiscoNP- abovetechniquesandresultsaredirectlyapplicablealsotomultipleinheritance argument.webelievethatoncetheresolutionmechanismisdetermined,the itance.also,insomeproposals,itisrequiredthattherstargument,called andattachmenttorstargument. Eachinstanceofamethodisthenviewedas\attached"totheclassoftherst thereceiver,ofamethodmustdeterminetheresolutionofnameoverloading. Insomeproposalstheclasshierarchyisadagandonehasmultipleinher- thissection,wedescribeaverysimplewayofencodingrelationsasinterpreted interpretationofthebasemethodsinordertomakethisquestionprecise.in basemethods,andweshowthatunderthisinterpretation,methodschemas 3TheExpressivePowerofMethodSchemas Ofcourse,sincemethodschemasarejustschemas,onehastoagreeonthe expressexactlytheptimequeries.weassumesomefamiliaritywithdatalog Whenconsideringmethodschemasinthecontextofnitedatabases,itisnatural terminologyandnotationfrom[28,41],e.g.,rules,edbs,idbsetc. toaskwhatkindofqueriescanbeexpressedinthemethodschemaframework. otherrelationooveru.thearitiesandattributenamesoftheinputandoutput relationsaregivenbysomexedrelationalschemas. 3.1I/OConventions Weconsiderqueriesoverniteorderedrelationaldatabases.Theinputofa positiveintegers)andsomerelationsp;q;r;:::overu,andtheoutputisan- queryconsistsofaniteordereduniverseu(w.l.o.ganinitialsegmentofthe elementsoftheuniversearerepresentedbyobjectsofclassnumberandthe orderingamongthemisgivenbyabasemethodpred@number:numberwhich Weencodethesedatainthemethodschemaframeworkasfollows.The

sentedbyanobjectofclasszero,whichisasubclassofnumber.wecapture FunctionalProgrammingFormalismsforOODBMethods computesthepredecessorfunction.theinitialelementoftheuniverseisrepre- thenitenessoftheuniversebyprovidingitssizeaspartoftheinput.more precisely,weprovideaspartoftheinputanobjectnofclassnumbersuchthat jectofclasszeroandthatthereisatleastonenon-zeroelementintheuniverse. NdoesnotappearintherangeofPred.Weassumethatthereisauniqueob- 11 languageismswithorder. Whenourinterpretationssatisfythesesemanticconditionswewillsaythatour classnumberifthetuplerepresentedby(x1;:::;xk)belongstorandanobject r@number;:::;number:number,suchthatr(x1;:::;xk)returnsanobjectof ofclasszeroifitdoesnot.wewillfrequentlywriter(~x)insteadofr(x1;:::;xk) ifthearityofthemethoddoesnotmatter. Ak-aryrelationRisrepresentedbyak-arybasemethodrofsignature q@number;:::;number:number.ifq(~x)reducestoanobjectofclassnumber, oftheoutput. andzero=f0g,wewouldinterpretpredaspred(2)=1,pred(1)=pred(0)=0, thenthetuplerepresentedby~xisconsideredpartoftheoutput;ifq(~x)reduces andwewouldinterpretrasr(1;1)=r(1;2)=1,r(x;y)=0forallotherx;y. f0;1;2g,wewouldpopulatetheclassesnumberandzeroasnumber=f1;2g toanobjectofclasszero,thenthetuplerepresentedby~xisnotconsideredpart Queriesarerepresentedbycodedmethodsqwithasignatureoftheform Forexample,toencodetherelationR=f(1;1);(1;2)govertheuniverseU= oftheseconcepts).theresultsofimmerman[27]andvardi[42]thenimplythat Weshowthatundertheinput/outputconventionsgivenabove,methodschemas cancomputeinationaryxpointsofdatalog:programs(see[28]forasurvey methodschemascancomputeallptimequeriesoverniteordereddatabases. 3.2ExpressingPTIMEQueries anumberobject,orfalsewhenitreturnsthezeroobject. Pred(N),wherePred@Number=x:Pred(Pred(x))andPred@Zero= x:x.)wewillofteninformallysaythatamethodreturnstruewhenitreturns functions.werepresentthetruthvaluestrueandfalsebytheclassesnumber singleobject0ofclasszerorepresentsfalse.(notethatwecancompute0as0= andzero.anyobjectofclassnumber(n,forexample)representstrue,andthe TheBooleanfunctionscanbecodedas: Tobeginwith,letusillustratehowtocodesimpleBooleanandarithmetical And@Zero;Number=xy:0 And@Zero;Zero Not@Number Not@Zero And@Number;Zero=xy:0 And@Number;Number=xy:N(andsimilarforOr) Equal@Zero;Zero =x:0(where0:=pred(n)) =x:n

12 denemethodspredkisuchthatpredki(x1;:::;xk)istheithcomponentofthe WealsoneedtoextendthePredfunctiontok-tuplesofobjects.Below,we Equal@Zero;Number=xy:0 Equal@Number;Zero=xy:0 Equal@Number;Number=xy:Equal Pred(x);Pred(y) GerdHillebrand,ParisKanellakis,andSridharRamaswamy lexicographicalpredecessorofthetuple(x1;:::;xk),for1ik. Number;:::;Number;k i+1 i 1 ourpurposes,wecanthinkofadatalog:programasarelationalexpression Withthismachineryinplace,wecannowcodeDatalog:programs.For Predki@ z } ki { z} { Zero;:::;Zero=x1:::xk:N Zero;:::;Zero=x1:::xk:Pred(xi) andproject.thesemanticsoftheprogramaregivenbytheleastxpointof E(O;P;Q;R;:::)involvingadesignatedoutputrelationO,inputrelationsP, canbecomputedbyiteratingthismappingnktimes,wherenisthesizeofthe Q,R,:::,andtheoperatorsUnion,Intersection,Complement,Times,Select, themappingo7!o[e(o;p;q;r;:::).itiswellknownthattheleastxpoint =x1:::xk:xi(i6=k) universeandkisthearityofo. relationsrandsasdescribedabove,then: Therelationaloperatorscanbecodedasfollows.Assumethatrandscode Projectionisabitmoredicult,becauseitinvolvesquantierelimination. Intersection(r;s)~x:And r(~x);s(~x) Times(r;s)~x~y:And r(~x);s(~y) Complement(r)~x:Not r(~x) Selecti=j(r)~x:And r(~x);equal(xi;xj) Union(r;s)~x:Or r(~x);s(~x) TheprojectionofRontoitsrstk 1columnsisencodedas: r(x1;:::;xk 1;z)isTrue.r0canbecodedasfollows: wherer0(x1;:::;xk 1;y)isTrueithereexistsaz2f0;:::;ygsuchthat r0@ Project(r)x1:::xk 1:r0(x1;:::;xk 1;N); x1:::xk 1y:Or r(x1;:::;xk 1;y);r0(x1;:::;xk 1;Pred(y)) z Number;:::;Number;Zero=x1:::xk 1y:r(x1;:::;xk 1;y) Number;:::;Number;Number= } {

xpointofewithrespecttooisgivenby: representingo,andletebethecodedmethodcorrespondingtoe.thenthe bearelationalexpression.letkbethearityofo,letobethebasemethod FunctionalProgrammingFormalismsforOODBMethods Finally,wehavetoshowhowtocomputexpoints.LetE(O;P;Q;R;:::) Fix(o;e)x1:::xk:o0(x1;:::;xk;k z} { N;:::;N); 13 O7!O[E(O;P;Q;R;:::),~nbeinginterpretedasabase-(N+1)number. o0canbedenedasfollows: whereo0(~x;~n)istruei~xisintheimageofthe~nthiterateofthemapping wherethemethodearisesfromebyreplacingeveryoccurrenceofo(~x)ineby o0(~x;predk1(~n);:::;predk(~n)). o0@number;:::;number;k z} { Thus,foreveryDatalog:program(interpretedinaninationaryfashion ~x~n:or o0(~x;predk1(~n);:::;predk(~n));e(~x) ; z Number;:::;Number= Zero;:::;Zero k { =~x~n:0 canexpresseveryptimequery. Lemma6.UndertheinputoutputconventionsofSection3.1,MSwithorder spondenceofniteorderedrelationaldatabasesandmethodschemawithorder interpretations.wecanconcludethat, input-outputconventionsofsection3.1,thereisaneasytoseeone-to-onecorre- Firstnotethatthismethodschemaisconsistent.Alsonotethat,underthe theinput-outputconventionsofsection3.1)thatcomputesthesamequery. overanorderedinput)onecanconstructamethodschemawithorder(under Inthissection,weshowthattheexpressivepowerofmethodschemasover methodschemasexpressexactlytheptimequeries. orderedniteinterpretationsisnomorethanthatofdatalog:overordered input.this,combinedwiththepreviousreduction,allowsustodeducethat 3.3SimulatingMethodSchemasinDatalog thatorderstheinput. theinputsofthemethodandthe(k+1)thargumentistheoutput.basemethods meansofaunaryedbpredicate.thefactthattheinputisorderediscaptured inthedatalogsimulationbymeansofaspecialinterpretedbinaryedbpredicate correspondnaturallytoedbsandcodedmethodstoidbs.thedisjointobject arityk+1.theunderstandingisthattherstkargumentsofthepredicateare input/outputcharacteristicsofamethodofaritykbymeansofapredicateof assignmenttoclassesinaninterpretationofamethodschemaissimulatedby Wewillrstexplaintheintuitionbehindthesimulation.Wecapturethe willbeinputdatabasestothedatalogprogramthatdonotcorrespondtoany Twotechnicalproblemsarisewiththisapproach.Therstisthatthere

14 theinputdatabasedoesnotcorrespondtoavalidinterpretation.thesecond interpretationforthemethodschema.inordertohandlethiscase,weintroducerulesthatwill\ood"thecomputationbyderivingeverypossiblefactif technicalproblemistheissueofinconsistencies.inthecaseofmethodschemas, aninconsistencycorrespondstoanabnormalterminationofcomputation.in thedatalogsimulation,wesimplyfailwhenaninconsistencyoccursinthecorrespondingmethodexecution.thetwocasesaresimilarinthesensethatno outputisproducedfortheoendingmethodcall. plexity,wewillassumethatthesizeofthemethodschemaisxed.wewillalso schemas,wewillconstructadatalogprogrampssuchthatthecomputations assumethattherearenoambiguousmethoddenitions.(thisisasyntactic propertythatcanbecheckedinconstanttime.)further,wewillalsoassume thatallthemethoddenitionsareexplicitatalltheclassesatwhichtheyare weassumethatsisofxedsize,thisdoesnotmatter.fortheinputmethod dened.thismightincreasethesizeoftheschemabyafactorofckwherecis thesizeoftheclasshierarchy,andkthemaximumarityofthemethods.since ConsideraschemaS=(C;;0;1).Sinceweareinterestedindatacom- GerdHillebrand,ParisKanellakis,andSridharRamaswamy performedbysandpsareequivalentinasensewhichwillbeexplainedbelow. 1.Foreachclassc2C,aunaryEDBpredicateIsac.TheIsacpredicatesare PShasthefollowingpredicates: 5.AnIDBpredicateNotequalthatcapturesinequalitybetweeninputobjects. 4.Foreachcodedmethodm21ofarityk,a(k+1)-aryIDBpredicatem. 3.Foreachbasemethodm20ofarityk,a(k+1)-aryEDBpredicatem. 2.AspecialinterpretedbinarypredicatePredthatorderstheinputbyprovidingthepredecessorfunction.Therewillbeobjectso0(zero)andoN(highest valueofx.predcorrespondsnaturallytotheinterpretedbasemethodpred object)suchthatpred(o0;o0)isafactandpred(x;on)isnottrueforany meanttocapturethemeaningofthedisjointobjectassignment. inmethodschemas. correspondingidbpredicatemhasthefollowingrule.thevariablesintherule formcorrespondto(1)theinputstothiscodeformethodmand(2)theresult andintermediateresultsofthiscodeformethodm. 6.AunaryIDBpredicateFloodthatwillbeusedtocheckthevalidityofthe Foreachmethoddenitionm@c1;c2;:::;ck=x1;:::;xk:m1()inS,the inputdatabase. ItiscodedintermsofPred. built-ininterpreterinmethodschemas.)theargumentstothesemethodsare Theunderstandinghereisthattherstkpredicatesactas\guards"making arrangedastheywouldbeinamethodschemaexecution. surethatthe\code"thatgetsexecutedhastheargumentsinthecorrectclasses. Afterthat,wehavethemethodnamesthatappearinthecodeofmsortedin left-to-righttopologicalorder.(thisistheorderofexecutionprovidedbythe m(c1;c2;:::;ck;x): Isac1(C1);:::;Isack(Ck); mi1(:::);mi2(:::);:::;m1(:::;x);

dierentwaysinwhichtheinputdatabasecanbeinvalid.theyare:(1)the (4)abasemethodmightproducearesultofaninvalidoutputclass.Wehandle FunctionalProgrammingFormalismsforOODBMethods disjointobjectassignmentcouldbeinvalid;(2)abasemethodcouldbeundened atsomepointwhereitissupposedtobedened(basemethodscorrespondto totalfunctions);(3)abasemethodcouldbemultiplydenedatsomepoint; WenowwritedownthedenitionsfortheFloodpredicate.Therearefour 15 theseonebyonebymeansofthefollowingrules.beforethat,weneedtocode enforcethedisjointobjectassignment: inequalityamongobjects.thisiseasilydonewiththefollowingrules: Foreverypairofclassesc1andc2(c16=c2),weusethefollowingruleto Notequal(X;Y): Pred(X;X0);Pred(Y;Y0);Notequal(X0;Y0); Flood(X): Isac1(C);Isac2(C); Notequal(X;Y): :Pred(X;X);Pred(Y;Y); Notequal(X;Y): Pred(X;X);:Pred(Y;Y); thereisanobjectthatdoesnotbelongtoexactlyoneclass,flood(x)isderived wherec1;c2;:::;clarealltheclassesinc.theserulesensurethatwhenever forallvaluesofx. everyidbpredicatep: Weoodthecomputationbywritingdownrulesofthefollowingformfor Tomakesurethateveryobjectbelongstoaclass,weusethisrule: Flood(X): :Isac1(C);:Isac2(C);:::;:Isacl(C); thefollowingrulesthatoodthecomputationifmisnotdenedeverywherein (c1)(ck): Next,ifabasemethodminShasthesignaturem@c1;:::;ck:ck+1,wewrite Next,forabasemethodminSwiththesignaturem@c1;:::;ck:ck+1,we Flood(X): Isac1(C1);:::;Isack(Ck);:m(C1;:::;Ck;Ck+1); p(x1;:::;xk): Flood(X); writethefollowingrulethatoodsthecomputationifmismultiplydened thefollowingrulethatoodsthecomputationifmisimproperlydened,i.e., somewherein(c1)(ck). Finally,forabasemethodminSwithsignaturem@c1;:::;ck:ck+1,wewrite Notequal(Ck+1;C0k+1); m(c1;:::;ck;ck+1);m(c1;:::;ck;c0k+1);

16 theresultbelongstoaninvalidclass.letck1;ck2;:::;ckjbethesubclassesof ck+1,includingck+1itself. Flood(X): Isac1(C1);:::;Isack(Ck); m(c1;:::;ck;ck+1); :Isack1(Ck+1);:::;:Isackj(Ck+1); GerdHillebrand,ParisKanellakis,andSridharRamaswamy indatalog:bymeansoftheisac,m,andprededbpredicatesisthesamesize and\valid"inputdatabasesforps. astheoriginalmethodschemainterpretation. Lemma7.EveryinterpretationformethodschemaScorrespondstoaninput ofinterestisthesizeoftheinputdatawhichwemeasurebythesizeoftheinterpretationi.itisimmediatelyclearthatourrepresentationofaninterpretation Wenowestablishaone-to-onecorrespondencebetweeninterpretationsforS Sinceinthissimulationweareinterestedindatacomplexity,theparameter sensethatflood(x)willneverbederivedforanyvalueofxforsuchadatabase. Lemma8.Every\valid"inputdatabaseforPS(oneinwhichFlood(X)is databaseforps.further,thisinputdatabaseisa\valid"inputdatabaseinthe neverderivedforanyvalueofx)correspondstoaninterpretationfors. Lemma10.Ifafactm(o1;o2;:::;ok;ok+1)canbederivedinPSwithavalid bederivedforanyvalueofxinsuchaninputdatabase. performthesamecomputations. Lemma9.Acalltomethodmwithargumentso1;o2;:::;okinaninterpretationIterminateswitharesultok+1ifandonlyifm(o1;o2;:::;ok;ok+1)canbe derivedinthecorrespondinginputdatabaseinps.further,flood(x)willnever Now,wecanusestructuralinductiontoshowthatSandPSdoindeed witharesultok+1inthecorrespondinginterpretationforp. inputdatabase,thenacalltomethodmwithargumentso1;o2;:::;okterminates expressesexactlyptime. 4TheTypedLambdaCalculuswithEquality(TLC=) 4.1LanguageDenition Theorem11.UndertheinputoutputconventionsofSection3.1,MSwithorder Weputeverythingtogetherinthefollowingtheorem: Typed-termsaregivenbythegrammarExj(EE)jx:T:E,wherexranges overasetofexpressionvariables.asusual,!!standsfor!(!) andpqrstandsfor(pq)r. overasetoftypevariables.thus,isatype,asare(!)and(!(!)). ThesyntaxoftypesisgivenbythegrammarTtj(T!T),wheretranges

where isafunctionfromexpressionvariablestotypes,and [x:]isthe FunctionalProgrammingFormalismsforOODBMethods function 0augmenting with 0(x)=: (Var) Well-typednessofexpressionsisdenedbythefollowinginferencerules, (x)= `x: 17 (!-Elim) (!-Int) `e:!0 `e0: `x::e:!0 [x:]`e:0 max(1+o(0);o(00)).wealsorefertotheorderofatyped-termastheorder ofitstype. termofthattype,isdenedaso(t)=0foratypevariablet,ando(0!00)= isderivablebytheaboverules,forsome and. Forwell-typed-termse;e0,wewritee>e0(-reduction)whene0canbe Theorderofatype,whichmeasuresthehigher-orderfunctionalityofa- Inwhatfollows,wewrite\typed-termE"tomeanEiswelltyped: `E: `ee0:0 derivedfromebyrenamingofaboundvariable,forexamplex::y::y> x::z::z.wewritee>e0(-reduction)whene0canbederivedfromeby =:o!o!!!.forconstantsa;b:o,a6b,weaddto>the constantsoftypeo,andforsomexedtype,introducinganequalityconstant above,byenrichingthesimply-typed-calculuswithacountablyinnitesetof replacingasubtermineoftheform(x::e)e0bye[e0=x](ewithe0substitutedforallfreeoccurrencesofxine).thefactthatthesubtermanditrem[12,theorem4.2.8].wewrite>forthereexive,transitiveclosureof replacementhavethesametypeisreferredtoasthesubjectreductiontheo- >and>. existsa-terme000suchthate0>e000ande00>e000. Theorem12(Church-Rosserproperty).Ife>e0ande>e00,thenthere reductionrules(=aa)>(x::y::x)and(=ab)>(x::y::y). Inthispaper,weconsideramildmodicationofthestandardpresentation reductions. Theorem13(Strongnormalizationproperty).Foreache,thereexistsan integernsuchthatife>e0,thenthederivationinvolvesnomorethann- Themodiedsystemenjoysthefollowingwell-knownproperties: discussesthechurch-rosserpropertyfortheuntyped-calculusenrichedwith equality.wereferto[25]forhowtoremoveequalityfromthelanguage. i.e.theproblemofdecidingwhetheragiven(untyped)termcanbetyped,seefor ForresultsconcerningthetypeinferenceproblemforTLCanditsextensions, Formoredetails,seeforexample[19,11].Inparticular,[11,Section15.3]

of[35]withoutletandwithoutanyexplicitxpointconstruct. calculus.ithasnotypepolymorphismandisasubsetofthecore-mllanguage unication. 18 example[29].thetypeinferenceproblemfortlc=isequivalenttorst-order Notethat,thelanguagepresentedaboveisthe\simplest"typedlambda GerdHillebrand,ParisKanellakis,andSridharRamaswamy 5TheExpressivePowerofTLC= Lisatypabletermnomatterwhattypewechoose(thoughonexedterm howitworksanditslimitations. Theprincipaltechnicaltoolforthissectionislistiteration.Letusbrieyreview isa-termoftype(!!)!!,foranytype inotherwords, mustbechosen).weabbreviatethislistconstructionas[x1;x2;:::;xk];the variablescandnabstractoverthelistconstructorsconsandnil.listiteration implementsprimitiverecursion. Lc:!!:n::cx1(cx2:::(cxkn):::) Letfx1;x2;:::;xkgbeasetof-terms,eachoftype;then andfalsex::y::y,bothoftypebool!!.denetheexclusive oras andtheparityofalistofbooleanvaluesas Xorp:Bool:q:Bool:x::y::p(qyx)(qxy) ParityL:(Bool!Bool!Bool)!Bool!Bool:LXorFalse: Forexample,astandardcodingofBooleanlogicusesTruex::y::x Unlikecircuitcomplexity,thesizeoftheprogramcomputingparityisconstant, becausetheiterativemachineryistakenfromthedata,i.e.,thelistl. wheresuccn:(!)!!:s:!:z::ns(sz)andzeros:! :z::zcodesuccessorandzeroonthechurchnumerals(oftypeint(! )!!). LengthL:(!Int!Int)!Int!Int:L(x::Succ)Zero; Ontheotherhand,tocomputethelengthofalist,wedene Bool!!substitutedfor,whichwewriteasB[:=Bool].Similarly,!)!!foranytype.TotypeParityL,wemusttypeLwith totypelengthl,weneedtotypel:b[:=int].thinkingofthetypeofl tothisproblem. simplytypedlambdacalculus:itslackofpolymorphism.therearetwofacets asanoutputtypevariable,inbothinstancesweseethattheoutputtypemust be\contaminated"or\raised"toprovidetheprimitiverecursiveiterator.ifwe (1)AlistLofBooleanscanbecodedasatermoftypeB(Bool! Thesetwosimpleexamplespointalreadytoarestrictionimposedbythe

codings,forexample FunctionalProgrammingFormalismsforOODBMethods wanttheoutputtypeofinputltobexed,andtwodierentoutputtypesare neededtocarryoutthecomputation,thisposesaproblem. LengthL:(!!)!!:s:!:z::L(x::s)z; Wepointoutthatproblem(2)cansometimesbehandledbyalternateen- (2)Ifwewanttheoutputtypetoremain,thisposesyetanotherdiculty. 19 wherelisusedtoiterateoverobjectsoflowertype.problem(1)canbesolved Int,andusingthistypingtoiterativelygeneratetwocopiesofthelist,with bydeningtheoutputtypetobeasuitablydenedcrossproductofbooland setsofrelations,whichareencodedaccordingtotheschemebelow. respectiveoutputtypesboolandint. followingsections. 5.1I/OConventions Theparadigmweuseiscomputationonnitestructures,i.e.,a-calculusfor nitemodeltheory.inputsandoutputsofacomputationaredatabases,i.e., Thesetechniques,withelaboratevariants,areexploitedrepeatedlyinthe basetypeo.wealsox,onceandforall,atypevariable. Weabbreviatethetype!!asBool. True:!!u::v::u; False:!!u::v::v: Booleanvaluesarerepresentedby Westartoutwithacountablyinnitesupplyo1;o2;:::ofconstants,ofsome 1;:::;k,then Weabbreviatethetype(1!!k!)!as1kor,ifi hx1;:::;xki:(1!!k!)! Tuplesarerepresentedinthestandardway:ifx1;:::;xkare-termsoftype then for1ik,ask.inparticular,okisthetypeofak-tupleofconstants. [x1;:::;xk]:(!!)!! Listsarerepresentedasdescribedabove:ifx1;:::;xkare-termsoftype, f:1!!k!:fx1:::xk oftermsofaxedtype. thetypeofak-aryrelationisfokg.notethat,inallthisdevelopmentweuse termsofvaryingtype,whereasalistrepresentsacollectionofavariablenumber betweenlistsandtuples:atuplerepresentsacollectionofaxednumberof Weabbreviatethetype(!!)!!asfg.Notethedierence Relationsarerepresentedasduplicate-freelistsoftuplesofconstants.Thus, c:!!:n::cx1(cx2:::(cxkn))

the-calculus;butweshowhowtoeliminateduplicates. whenappliedtoencodingsr1;:::;rkofinputrelations,reducetoanormalform 20 listsinsteadofnitesets,becausenitesetsarenotavailableinthesyntaxof whichistheencodingofthedesiredoutputrelation.wemeasurethetime complexityofcomputationbythelengthofreductionsequences,accordingtoa Queriesarerepresentedas-termsoftheformQR1:::Rk:M,which GerdHillebrand,ParisKanellakis,andSridharRamaswamy eratorwhichisalistofalltheobjectsintheuniverse(theequivalentofthe isequivalenttothe\relationsascharacteristicfunctions"conventionadopted insection3.1,providedthatinthelattercase,theinputcomeswithanit- \sizeparameter"ninthemethodschemascase).clearly,withoutanyapriori knowledgeoftheuniverse,itisimpossibletoobtainalistingofarelationfrom itscharacteristicfunction. xedevaluationstrategy,asafunctionofthedatabasesize. universe,thentranslationsbetweenthetwoconventionsareeasilyfurnished. However,ifweassumetheexistenceofaniteratorU:fogrepresentingthe Itisinterestingtoobservethatthe\relationsasiterators"conventionabove Indeed,ifR:fokgisaniteratorencodingarelationr,then r:k z} { o!!o!bool functionofarelationr,then (whereequalk,theequalitypredicatefork-tuples,isdenedbelow)computes thecharacteristicfunctionofr. x1:o:::xk:o: R:fokg Ontheotherhand,ifr:o!!o!Boolencodesthecharacteristic u::v:: c:ok!!:n:: R(r:ok:T::(Equalkrhx1;:::;xki)uT)v isaniteratorrepresentingr. U(x1:o:T1:: U(x2:o:T2:: U(xk:o:Tk:: order3.the(moresimple)encodinggivenbelowusestypesoforder4. ispossibletoexploitthis\ordereconomy"ofcharacteristicfunctionstoprovide thesensethatitstypeisoforder1,whereasthetypeofaniteratorisoforder2.it anencodingofallptimecomputablequeriesinthetypedlambdacalculusof Notethatthecharacteristicfunctionrepresentationofarelationissimplerin (rx1:::xk)(chx1;:::;xkitk)tk)tk 1):::T1)n

FunctionalProgrammingFormalismsforOODBMethods 5.2ExpressingRelationalQueries Inthissection,weshowhowtoexpresstherelationalalgebraoperatorsof[20] inthesimplytypedlambdacalculuswithequality.everyoperatoriscodedas a-termthattakesoneortworelationsinthelist-of-tuplesformatdescribedin Section5.1asinputandproducesanotherrelationinthesameformatasoutput. Thehomogeneityoftheinputandoutputformatallowstheresultofoneoperator 21 termuv:uifthecomparisoncomesouttrueanduv:votherwise.thecode dependsonthearityofthetuplesinvolved,soweusethesubscriptktoindicate thatthisparticulartermworksfork-tuples. f:fb1:::bkforequality.theresultofthecomparisonisabool,i.e.,the operators. applicationtobeusedasinputtoanother,sothatarbitraryrelationalalgebra expressionscanbecodedbynestingthe-termscorrespondingtotheindividual Equalk:ok!ok!Bool Webeginwitha-termEqualkthatteststwok-tuplesf:fa1:::akand t:ok:s:ok: u::v:: t(x1:o:::xk:o: s(y1:o:::yk:o: ((Eqx1y1) the\body" Oncetandsareinstantiatedwithtuplesf:fa1:::akandf:fb1:::bk,all (Eqxiyi)termsreducetoeitherTrueu:v:uorFalseu:v:v.Hence Here,Eqdenotestheequalitypredicateforconstants,oftypeo!o!Bool. ((Eqx2y2) u::v:: ((Eqxkyk)uv)v)v))) t(x1:o:::xk:o: s(y1:o:::yk:o: ((Eqx1y1) ((Eqx2y2) alistcn:ct1(ct2(ctmn))ofk-tuplesbycomparingthetupletoevery twok-tuplesinaprocedurallanguage. pendentofthereductionstrategy),whichmatchesthetimeneededtocompare oftheequalkpredicatereducestou:v:uifai=biforalliandtou:v:v otherwise.notethatthenalresultisreachedaftero(k)reductionsteps(inde- Thefollowingtermcheckswhetherak-tuplef:fa1:::akisamemberof ((Eqxkyk)uv)v)v)))

22 elementofthelist. Memberk:ok!fokg!Bool t:ok:r:fokg: u::v:: R(r:ok:T::(Equalkrt)uT)v GerdHillebrand,ParisKanellakis,andSridharRamaswamy Forexample,(Member2h1;2i[h3;4i;h5;6i])reducesto oftheinputlist,andthisagainmatchesthetimerequiredbyastraightforward proceduralimplementation. ofreductionsneededtoreachthenormalformiso(mk),wheremisthelength whichinturnreducestou:v:v,becauseboth(equal2:::)termsevaluate (whichreducesaredex(x:m)nonlyafterfullyreducingn),thenthenumber tofalse.ifthereductionsaredoneaccordingtoaneagerreductionstrategy u:v:(equal2h3;4ih1;2i)u((equal2h5;6ih1;2i)uv); sibletoreduceanexpression(memberktr),whererisoflengthm,toaterm substitutingit. witho(km)redexesbyneverevaluatingthefourthargumenttoequalkbefore multipliesbyk.sincethishappensateverylevelofequalknesting,itispos- unresolvedredexesissubstitutedforv(e.g.,theterm((equal2h5;6ih1;2i)uv) intheexampleabove),thenthenumberofredexesinthewholeexpression tialnumberofreductionsteps.thisisduetothefactthatthefourthparameterv oftheequalkpredicateoccursktimesinthebodyofthepredicate.ifatermwith Notethattherearealso\bad"reductionstrategieswhichleadtoanexponen- occursins,itisincludedintheoutput,otherwiseitisignored. by\walkingdown"randtestingeachtupleformembershipins.ifthetuple atorsoftherelationalalgebra: Intersection:Tointersecttwok-aryrelationsRandS,webuildanewrelationT Intersectionk:fokg!fokg!fokg WiththeaidofEqualandMember,wecannowcodetheset-theoreticoper- R:fokg:S:fokg: c:ok!!:n:: cludedintheoutputifitdoesnotoccurins. Setdierence:Thisworkslikeintersection,exceptthatatuplefromRisin- whichfurtherreducestoc:n:ch1;2in[h1;2i]. Forexample,(Intersection2[h1;2i][h1;2i;h3;4i])reducesto c:n:(member2h1;2i[h1;2i;h3;4i])(ch1;2in)n; R(r:ok:T::(MemberkrS)(crT)T)n Setminusk:fokg!fokg!fokg

andaddingthosetuplesofrthatdonotoccurins. FunctionalProgrammingFormalismsforOODBMethods Union:Theunionoftwok-aryrelationsRandSisformedbystartingwithS R:fokg:S:fokg: c:ok!!:n:: R(r:ok:T::(MemberkrS)T(crT))n 23 (IfweknewthatRandSweredisjoint,wecouldformtheirunionbyjust Unionk:fokg!fokg!fokg R:fokg:S:fokg: c:ok!!:n:: atorconcatenatesak-tupleandanl-tupletoforma(k+l)-tuple,andthe weneedthemorecomplextermabovetoensureaduplicate-freeoutput.) oriented"operators.weneedtwoauxiliarytermsrst:theconcatk;loper- concatenatingthemasfollows:c:n:rc(scn).inthegeneralcase,however, Havingdealtwiththe\set-oriented"operators,wenowexaminethe\tuple- R(r:ok:T::(MemberkrS)T(crT))(Scn) columnsi1;:::;iloftheinput. Rearrangek;i1;:::;iloperatortakesak-tupleandreturnsanl-tupleconsistingof Concatk;l:ok!ol!ok+l Rearrangek;i1;:::;il:ok!ol t:ok:s:ol: t:ok:f:o!!o!: f:o!!o!: t(x1:o:::xk:o: t(x1:o:::xk:o: s(y1:o:::yl:o: fxi1xil) fx1xky1yl)) Crossproduct:TheCartesianproductofk-aryrelationRandl-aryrelationS isformedbyastraightforwardnestediteration,inwhicheverytupleofris concatenatedwitheverytupleofsandappendedtotheoutput. Timesk;l:fokg!folg!fok+lg R:fokg:S:folg: c:ok+l!!:n:: R(r:ok:T:: S(s:ol:U:: c(concatk;lrs)u)t)n

24 Forexample,(Times1;1[h1i;h2i][h3i;h4i])reducesto c:n:c(concat1;1h1ih3i) (c(concat1;1h1ih4i) (c(concat1;1h2ih3i) GerdHillebrand,ParisKanellakis,andSridharRamaswamy Selection:Toselecttuplesfromak-aryrelationRaccordingtoacertaincondition,saycolumni=columnj,itsucestoiterateoverRandincludethose tuplesintheoutputthatsatisfythecondition. whichfurtherreducesto[h1;3i;h1;4i;h2;3i;h2;4i]. Selectk;i=j:fokg!fokg(c(Concat1;1h2ih4i)n))) columnsi1;:::;ilofak-aryrelationr, Projection:Thisisslightlytricky.Thestraightforwardattempttoprojectonto R:fokg: SimpleProjectk;i1;:::;il:fokg!folg c:ok!!:n:: R:fokg: R(r:ok:T:: c:ol!!:n:: r(x1:o:::xk:o:(eqxixj)(crt)t))n inrwhoseprojectionist0: weincludetheprojectiont0oftupletintheoutputonlyiftisthersttuple hasthedisadvantagethattheoutputmaycontainduplicatetuples.toxthis, Projectk;i1;:::;il:fokg!folg R:fokg: c:ol!!:n:: R(r:ok:T::c(Rearrangek;i1;:::;ilr)T)n; where(firstrr):boolisanabbreviationfor u::v:: R(r0:ok:T0:: (Equall(Rearrangek;i1;:::;ilr) R(r:ok:T:: (Rearrangek;i1;:::;ilr0)) (FirstrR)(c(Rearrangek;i1;:::;ilr)T)T)n; ((Equalkrr0)uv)T0)u:

FunctionalProgrammingFormalismsforOODBMethods Toseewhythisworks,considerforexamplethequery(Project2;1[h1;2i;h1;3i]), whichprojectstherelation[h1;2i;h1;3i]ontoitsrstcolumn.theexpression (Firsth1;2i[h1;2i;h1;3i])reducesto u:v:(equal1h1ih1i) 25 reducesto whichfurtherreducestou:v:utrue,whereas(firsth1;3i[h1;2i;h1;3i]) u:v:(equal1h1ih1i) ((Equal1h1ih1i)((Equal2h1;2ih1;3i)uv)u); ((Equal2h1;2ih1;2i)uv) andthentou:v:vfalse.hence,thewholequeryreducesto c:n:(firsth1;2i[h1;2i;h1;3i]) ((Equal1h1ih1i)((Equal2h1;3ih1;3i)uv)u) ((Equal2h1;3ih1;2i)uv) thateverytermgivenaboveiswell-typedand,whenappliedtoone(resp.,two) andthentoc:n:ch1in[h1i]. relationscodedintheformatdescribedinsection5.1,reducestoanormalform whichistheencodingofthedesiredoutputrelation.moreover,whentheterms Thiscompletesthecodingofrelationalalgebra.Itisstraightforwardtoverify ((Firsth1;3i[h1;2i;h1;3i])(ch1in)n) (ch1i((firsth1;3i[h1;2i;h1;3i])(ch1in)n)) typedlambdacalculuswithequalitysuchthatforeveryinstance(r1;:::;rl)ofs, arereducedaccordingtoaneagerreductionstrategy(whichreducesaredex tionalschemas=(r1;:::;rl).thenthereexistsaterm typicallymatchestherunningtimeofanaiveproceduralimplementationofthe polynomialinthesizeoftheinputs.(infact,thelengthofthereductionsequence theexpression( operatorinquestion.)therefore,wehavethefollowingtheorem. (x:m)nonlyafterfullyreducingn),thelengthofthereductionsequenceis Theorem14.Let(R1;:::;Rl)bearelationalalgebraexpressionoverrela- ( ingofrelationrasdescribedinsection5.1.moreover,thenormalformof sizeofr1;:::;rl. evenabiteboul'sandbeeri'scomplexobjectalgebra[1].thistakesusfrom r1rl)canbecomputedinanumberofreductionstepspolynomialinthe Itispossibletoextendtheschemeabovetoanencodingofxpointsand r1rl)reducesto(r1;:::;rl),whererdenotestheencod- ofthesimply

26 manipulating\at"relationstomorecomplicateddatastructures,namelyarbitrarynitetreesbuiltfromtupleandsetconstructors.thealgebraunder considerationisextremelypowerful infactitexpressesany\generic"(see[16]) elementarytimecomputationonnitestructures. Theorem15.Let(R1;:::;Rl)beacomplexobjectalgebraexpressionoverthe GerdHillebrand,ParisKanellakis,andSridharRamaswamy typedlambdacalculuswithequalitysuchthatforeveryinstance(r1;:::;rl)ofs, sizeofr1;:::;rl. 6ConclusionsandSomeOpenProblems theexpression( relationalschemas=(r1;:::;rl).thenthereexistsaterm ofrelationr.moreover,ifthepowersetoperatorisnotused,thenormalform of( r1rl)canbecomputedinanumberofreductionstepspolynomialinthe r1rl)reducesto(r1;:::;rl),whererdenotestheencoding ofthesimply ourexpositionisthattheseformalismscanberelatedtotraditionaldatabase expressingdatabasequeriesorqueriesovernitestructures.themainpointof lus/algebra,datalog,etc. Wehaveexploredtwofunctionalformalisms,MSandTLC=,inthecontextof querylanguagesandcanexpressallthatisexpressibleusingrelationalcalcu- formofsignatureinferenceandhavehighlightedanumberofecientlydecidable Thefollowingopenproblemshighlightsometopicsforfutureresearch. tionalsetting,whilepreservingsomeofthebasictheoremsofdatabasetheory. explorationasanattempttochangethevocabularyfromarelationaltoafunc- formsclasses,methods,inheritance,nameoverloading,latebinding,andfor thembettervehiclesfortheformalstudyofoodbs.thus,onecanviewour TLC=higher-orderfunctionsandlist,set,andtuplestructuresviatyping)make MS:Wehaveinvestigatedtheconsistencyproblemofmethodschemasasa Webelievethattheadditionalfeaturesofthesefunctionalformalisms(e.g., ofincrementalconsistencychecking.inourformalizationofmethodschema consistency,allbasemethodsareuninterpreted.aswesawfromtheanalysisof cases.thedecidabilityofthearity2caseisstillopen,aswellasmanyaspects andcdrfunctionssothatwecan\glue"and\unglue"arguments.however,the problemofcheckingconsistencywithmonadiccodedmethodsandpolyadicbase methodswithoutequalityisopen. becomesundecidablewithmonadiccodedmethodsandpolyadicbasemethods whenaugmentedwithequality.withequality,wecansimulatethelispcar twoargumentsthatitissuppliedwitharethesame.consistencychecking consistencythen?forexample,letussupposethatwehaveequality,withits normalinterpretation,asabasemethod.thismethodwillsimplytellifthe expressivepowersomedegreeofsemantics,e.g.,order,isuseful.whatabout thecomplexobjectalgebraof[1].inourembeddingsweuselistsoftuplesand calculuswithequalityisthesimplestsyntaxtodate,thatcanbeusedtodescribe withoutaddedconstructsoraddedpolymorphism.forexample,thetyped- thatwepresenthereareinterestingforanumberofreasons.theyare\pure," TLC=:Theembeddingsofdatabasequerylanguagesinthetyped-calculus

shouldbeaddedtothetyped-calculustocaptureexactlythemorepowerful constructs,andsetiterationreplaceslistiterationin[15,13].oneopenquestion computationthatisnotelementaryisnotcapturedbyourframework.what FunctionalProgrammingFormalismsforOODBMethods Notalldatabasequerylanguagescanbeembeddedinthetyped-calculus.Any simulatesetsbyeliminatingduplicates.in[1,15,13]setsareusedasbasic is:howcanthe-calculussyntaxandsemanticsbeaugmentedwithsetiteration? 27 timeinsteadoftuple-at-at-timeevaluation,wouldbetheappropriateformalism investigated. theobject-orientedfeaturesofmsandtheexpressibilityanddataabstraction (orveryclosetoit)foroodbquerying.suchaformalismwouldhaveall theory,nitemodeltheory,andthetyped-calculus,thatshouldbefurther databasequerylanguagessuchasthecomputablequeriesof[16,2]?theuse capabilitiesoftlc=.giventheorganizationofdataintocollectionsonewould ofreductionstrategiesintheseembeddingsprovidesalinkbetweencomplexity orienteddialectsoflisp[7]illustratesuchlinguisticsyntheses(withoutsetsand withalesscleartypesystem).thechallengeistocomeupwithasimply typed(andelegant)formalsynthesis,thatalsofacilitatesthemanipulationof liketheevaluationmechanismtoemphasizesets,asin[1,15,13].object- MS+TLC=:WebelievethatasynthesisofMSandTLC=,withset-at-a- programminglanguagemodels.forexample,let-orml-polymorphism[35]isa veryusefulfeaturetoincludeinafunctionaldatamodel.thelanguagemlhas andsimplytypedcalculi.thisisarststeptowardsmorecomplexdatabase collectionsofobjects. beenthebasisformanyprogramminglanguageinvestigationsonstructureand butforpointerstotherecentliteratureandforaprogramminglanguageview methodinheritance.theliteratureistooextensivetoevenattemptasurvey, ofsomeoftheissuesraisedherewerecommend[36,37]. Inourexpositionwehaveexploredtherelationshipwithprogramschemas References 3.S.AbiteboulandP.Kanellakis.DatabaseTheoryColumn:QueryLanguagesfor 1.S.AbiteboulandC.Beeri.OnthePowerofLanguagesfortheManipulationof 2.S.AbiteboulandP.Kanellakis.ObjectIdentityasaQueryLanguagePrimitive. InProceedingsACMSIGMOD,pp.159{173,1989.(AlsoINRIATech.Rep.1022, 1989.) ComplexObjects.INRIAResearchReport846,1988. 5.S.Abiteboul,G.Lausen,H.Upho,andE.Waller.MethodsandRules.InProceedingsACMSIGMOD,pp.32{41,1993. JCSS,43(1991),pp.62{124. ComplexObjectDatabases.SIGACTNews,21(1990),pp.9{18. 4.S.Abiteboul,P.Kanellakis,S.Ramaswamy,andE.Waller.MethodSchemas. 6.S.AbiteboulandV.Vianu.DatalogExtensionsforDatabaseQueriesandUpdates. 7.N.AdamsandJ.Rees.Object-OrientedProgramminginScheme.InProceedings BrownUniversityTech.Rep.CS-92-33,1992.(AnearlierversionappearedinProceedings9thACMPODS,1990.) ACMLispandFunctionalProgramming,pp.277{288,1988.

28 GerdHillebrand,ParisKanellakis,andSridharRamaswamy 8.E.Ashcroft,Z.Manna,andA.Pnueli.DecidablePropertiesofMonadicFunctional Schemas.JACM,20(1973),pp.489{499. 9.F.Bancilhon,C.Delobel,andP.Kanellakis,editors.BuildinganObject-Oriented DatabaseSystem:TheStoryofO2.Morgan-Kaufmann,1992. 10.J.Banerjee,W.Kim,H-J.Kim,andH.Korth.SemanticsandImplementationof SchemaEvolutioninObject-OrientedDatabases.InProceedingsACMSIGMOD, pp.311-322,1987. 11.H.Barendregt.TheLambdaCalculus:ItsSyntaxandSemantics.NorthHolland, 1984. 12.H.Barendregt.FunctionalProgrammingandLambdaCalculus.InJ.vanLeeuwen, editor,handbookoftheoreticalcomputerscience,vol.b,pp.321{363.elsevier, 1990. 13.V.Breazu-Tannen,P.Buneman,andS.Naqvi.StructuralRecursionasaQuery Language.InProceedingsDBPL3,pp.9{19.Morgan-Kaufmann,1992. 14.V.Breazu-Tannen,P.Buneman,andL.Wong.NaturallyEmbeddedQueryLanguages.InProceedings4thICDT.LNCS,SpringerVerlag,1992. 15.P.Buneman,R.Frankel,andR.Nikhil.AnImplementationTechniquefor DatabaseQueryLanguages.ACMTODS,7(1982),pp.164{186. 16.A.ChandraandD.Harel.ComputableQueriesforRelationalDatabases.JCSS, 21(1980),pp.156{178. 17.A.ChandraandD.Harel.StructureandComplexityofRelationalQueries.JCSS, 25(1982),pp.99{128. 18.A.ChandraandD.Harel.HornClauseQueriesandGeneralizations.JLP,2(1985), pp.1{15. 19.A.Church.TheCalculiofLambda-Conversion.PrincetonUniversityPress,1941. 20.E.Codd.RelationalCompletenessofDatabaseSublanguages.InR.Rustin,editor, DatabaseSystems,pp.65{98.PrenticeHall,1972. 21.B.Courcelle.RecursiveApplicativeProgramSchemes.InJ.vanLeeuwen,editor, HandbookofTheoreticalComputerScience,Vol.B,pp.459{492.Elsevier,1990. 22.R.Fagin.GeneralizedFirst-OrderSpectraandPolynomial-TimeRecognizable Sets.SIAM-AMSProceedings,7(1974),pp.43{73. 23.S.Greibach.TheoryofProgramStructures:Schemes,Semantics,Verication. LNCSVol.36,Springer,1975. 24.Y.Gurevich.AlgebrasofFeasibleFunctions.InProceedings24thIEEEFOCS, pp.210{214,1983. 25.G.Hillebrand,P.Kanellakis,andH.Mairson.DatabaseQueryLanguagesEmbeddedintheTypedLambdaCalculus.InProceedings8thIEEELICS,1993. 26.R.Hull,K.Tanaka,andM.Yoshikawa.BehaviorAnalysisofObject-Oriented Databases:MethodStructure,ExecutionTreesandReachability.InProceedings3rdInternationalConferenceonFoundationsofDataOrganizationandAlgorithms,Paris1989. 27.N.Immerman.RelationalQueriesComputableinPolynomialTime.Info.and Comp.,68(1986),pp.86{104. 28.P.Kanellakis.ElementsofRelationalDatabaseTheory.InJ.vanLeeuwen,editor, HandbookofTheoreticalComputerScience,Vol.B,pp.1073{1156.Elsevier,1990. 29.P.Kanellakis,J.Mitchell,andH.Mairson.UnicationandML-typereconstruction.InJ-L.LassezandG.Plotkin,editors,ComputationalLogic:EssaysinHonor ofalanrobinson,pp.444{479.mitpress,1991.(alsoinproceedings16thacm POPL,1989andProceedings17thACMPOPL,1990.)

FunctionalProgrammingFormalismsforOODBMethods 30.W.Kim,F.Lochovsky.Object-OrientedConcepts,Applications,andDatabases. 31.P.KolaitisandC.Papadimitriou.WhyNotNegationByFixpoint?InProceedings 32.D.LeivantandJ.-Y.Marion.LambdaCalculusCharacterizationsofPoly-Time. Applications,Utrecht1993.(ToappearinFundamentaInformaticae.) InProceedingsoftheInternationalConferenceonTypedLambdaCalculiand Addison-Wesley,1989. 7thACMPODS,pp.231{239,1988. 29 36.J.C.Mitchell.TowardaTypedFoundationforMethodSpecializationandInheritance.InProceedings17thACMPOPL,pp.109{124,1990. pp.348{375. 394. Specialization.InProceedings8thIEEELICS,pp.26{38,1993. JCSS,4(1970),pp.220{249. 35.R.Milner.ATheoryofTypePolymorphisminProgramming.JCSS,17(1978), 37.J.C.Mitchell,F.Honsell,K.Fisher.ALambdaCalculusofObjectsandMethod 34.H.Mairson.ASimpleProofofaTheoremofStatman.TCS,103(1992),pp.387{ 33.D.Luckham,D.Park,andM.Paterson.OnFormalizedComputerPrograms. 38.D.Shipman.TheFunctionalDataModelandtheDataLanguageDAPLEX.ACM 39.A.SkarraandS.Zdonik.TypeEvolutioninanObject-OrientedDatabase.InB. 40.R.Statman.TheTyped-CalculusIsNotElementaryRecursive.TCS,9(1979), ShriverandP.Wegner,editors,ResearchDirectionsinObject-OrientedProgramming,pp.393{416.MITPress,1987. TODS,6(1981),pp.140{173. 45.R.Zicari.AFrameworkforSchemaUpdatesinanObject-OrientedDatabaseSys- 42.M.Vardi.TheComplexityofRelationalQueryLanguages.InProceedingsofthe 41.J.Ullman.PrinciplesofDatabaseSystems,2nded.ComputerSciencePress,1982. 43.E.Waller.SchemaUpdatesandConsistency.InProceedings2ndInternational 44.S.Zdonik,D.Maier.ReadingsinObject-OrientedDatabaseSystems.Morgan- Kaufmann,1990. pp.73{81. 14thACMSTOC,pp.137{146,1982. tem.inf.bancilhon,c.delobel,andp.kanellakis,editors,buildinganobject- ConferenceonDeductiveandObject-orientedDatabases,Munich1991. OrientedDatabaseSystem:TheStoryofO2,pp.146{182.Morgan-Kaufmann, 1992.