ResearchsupportedbyONRContractN J-4052,ARPAOrder8225.
|
|
|
- Debra Kennedy
- 9 years ago
- Views:
Transcription
1 FunctionalProgrammingFormalisms GerdHillebrand,ParisKanellakis, DepartmentofComputerScience Providence,RhodeIsland02912 andsridharramaswamy foroodbmethods BrownUniversity CS May1994
2
3 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 ResearchsupportedbyONRContractN J-4052,ARPAOrder8225.
4 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
5 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-
6 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))
7 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
8 6Head Tail @Int;Int:Int GerdHillebrand,ParisKanellakis,andSridharRamaswamy Fig.3.Methods :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-
9 (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
10 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 Sum Sum Sum Sum 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.
11 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
12 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 Weencodethesedatainthemethodschemaframeworkasfollows.The
13 sentedbyanobjectofclasszero,whichisasubclassofnumber.wecapture FunctionalProgrammingFormalismsforOODBMethods computesthepredecessorfunction.theinitialelementoftheuniverseisrepre- thenitenessoftheuniversebyprovidingitssizeaspartoftheinput.more precisely,weprovideaspartoftheinputanobjectnofclassnumbersuchthat jectofclasszeroandthatthereisatleastonenon-zeroelementintheuniverse. NdoesnotappearintherangeofPred.Weassumethatthereisauniqueob- 11 languageismswithorder. Whenourinterpretationssatisfythesesemanticconditionswewillsaythatour classnumberifthetuplerepresentedby(x1;:::;xk)belongstorandanobject ofclasszeroifitdoesnot.wewillfrequentlywriter(~x)insteadofr(x1;:::;xk) ifthearityofthemethoddoesnotmatter. Ak-aryrelationRisrepresentedbyak-arybasemethodrofsignature 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. x:x.)wewillofteninformallysaythatamethodreturnstruewhenitreturns functions.werepresentthetruthvaluestrueandfalsebytheclassesnumber singleobject0ofclasszerorepresentsfalse.(notethatwecancompute0as0= andzero.anyobjectofclassnumber(n,forexample)representstrue,andthe TheBooleanfunctionscanbecodedas: Tobeginwith,letusillustratehowtocodesimpleBooleanandarithmetical =x:0(where0:=pred(n)) =x:n
14 12 denemethodspredkisuchthatpredki(x1;:::;xk)istheithcomponentofthe WealsoneedtoextendthePredfunctiontok-tuplesofobjects.Below,we 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= } {
15 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
16 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 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);
17 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): Flood(X): Isac1(C1);:::;Isack(Ck);:m(C1;:::;Ck;Ck+1); p(x1;:::;xk): Flood(X); writethefollowingrulethatoodsthecomputationifmismultiplydened thefollowingrulethatoodsthecomputationifmisimproperlydened,i.e., somewherein(c1)(ck). Notequal(Ck+1;C0k+1); m(c1;:::;ck;ck+1);m(c1;:::;ck;c0k+1);
18 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
19 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]
20 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
21 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))
22 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
23 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)))
24 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
25 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
26 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:
27 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
28 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
29 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, 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.
30 28 GerdHillebrand,ParisKanellakis,andSridharRamaswamy 8.E.Ashcroft,Z.Manna,andA.Pnueli.DecidablePropertiesofMonadicFunctional Schemas.JACM,20(1973),pp.489{ F.Bancilhon,C.Delobel,andP.Kanellakis,editors.BuildinganObject-Oriented DatabaseSystem:TheStoryofO2.Morgan-Kaufmann, J.Banerjee,W.Kim,H-J.Kim,andH.Korth.SemanticsandImplementationof SchemaEvolutioninObject-OrientedDatabases.InProceedingsACMSIGMOD, pp , H.Barendregt.TheLambdaCalculus:ItsSyntaxandSemantics.NorthHolland, H.Barendregt.FunctionalProgrammingandLambdaCalculus.InJ.vanLeeuwen, editor,handbookoftheoreticalcomputerscience,vol.b,pp.321{363.elsevier, V.Breazu-Tannen,P.Buneman,andS.Naqvi.StructuralRecursionasaQuery Language.InProceedingsDBPL3,pp.9{19.Morgan-Kaufmann, V.Breazu-Tannen,P.Buneman,andL.Wong.NaturallyEmbeddedQueryLanguages.InProceedings4thICDT.LNCS,SpringerVerlag, P.Buneman,R.Frankel,andR.Nikhil.AnImplementationTechniquefor DatabaseQueryLanguages.ACMTODS,7(1982),pp.164{ A.ChandraandD.Harel.ComputableQueriesforRelationalDatabases.JCSS, 21(1980),pp.156{ A.ChandraandD.Harel.StructureandComplexityofRelationalQueries.JCSS, 25(1982),pp.99{ A.ChandraandD.Harel.HornClauseQueriesandGeneralizations.JLP,2(1985), pp.1{ A.Church.TheCalculiofLambda-Conversion.PrincetonUniversityPress, E.Codd.RelationalCompletenessofDatabaseSublanguages.InR.Rustin,editor, DatabaseSystems,pp.65{98.PrenticeHall, B.Courcelle.RecursiveApplicativeProgramSchemes.InJ.vanLeeuwen,editor, HandbookofTheoreticalComputerScience,Vol.B,pp.459{492.Elsevier, R.Fagin.GeneralizedFirst-OrderSpectraandPolynomial-TimeRecognizable Sets.SIAM-AMSProceedings,7(1974),pp.43{ S.Greibach.TheoryofProgramStructures:Schemes,Semantics,Verication. LNCSVol.36,Springer, Y.Gurevich.AlgebrasofFeasibleFunctions.InProceedings24thIEEEFOCS, pp.210{214, G.Hillebrand,P.Kanellakis,andH.Mairson.DatabaseQueryLanguagesEmbeddedintheTypedLambdaCalculus.InProceedings8thIEEELICS, R.Hull,K.Tanaka,andM.Yoshikawa.BehaviorAnalysisofObject-Oriented Databases:MethodStructure,ExecutionTreesandReachability.InProceedings3rdInternationalConferenceonFoundationsofDataOrganizationandAlgorithms,Paris N.Immerman.RelationalQueriesComputableinPolynomialTime.Info.and Comp.,68(1986),pp.86{ P.Kanellakis.ElementsofRelationalDatabaseTheory.InJ.vanLeeuwen,editor, HandbookofTheoreticalComputerScience,Vol.B,pp.1073{1156.Elsevier, 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.)
31 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, thACMPODS,pp.231{239, J.C.Mitchell.TowardaTypedFoundationforMethodSpecializationandInheritance.InProceedings17thACMPOPL,pp.109{124,1990. pp.348{ Specialization.InProceedings8thIEEELICS,pp.26{38,1993. JCSS,4(1970),pp.220{ 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{ R.Zicari.AFrameworkforSchemaUpdatesinanObject-OrientedDatabaseSys- 42.M.Vardi.TheComplexityofRelationalQueryLanguages.InProceedingsofthe 41.J.Ullman.PrinciplesofDatabaseSystems,2nded.ComputerSciencePress, 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.
Ďě Ž ť č ď ť ď ú ď ť ě Ě ň Ě ě ú ň ž ú ú Ú ú ú Ě ň é é ž ú ž Ť Ť Ť ú ň Ď ú ň ď Ě ú É ž ř ú ě ň ý Ě ň ý ň ň Ť ř ď ř ň ú Ť ě ř ě ý Š Ú Ú ň ň ú Ó Ú ň Ň Ů ž ú ň Č ř ř ú É ě ň ú Ž ý ú ú Ú Ú ť ž ž ď ý ž ď ž
Address Taken FIAlias, which is equivalent to Steensgaard. CS553 Lecture Alias Analysis II 2
Alias Analysis Last time Alias analysis I (pointer analysis) Address Taken FIAlias, which is equivalent to Steensgaard Today Alias analysis II (pointer analysis) Anderson Emami Next time Midterm review
DECLARATION OF PERFORMANCE NO. HU-DOP_TN-212-25_001
NO. HU-DOP_TN-212-25_001 Product type 212 (TN) 3,5x25 mm EN 14566:2008+A1:2009 NO. HU-DOP_TN-212-35_001 Product type 212 (TN) 3,5x35 mm EN 14566:2008+A1:2009 NO. HU-DOP_TN-212-45_001 Product type 212 (TN)
Statistics 100A Homework 7 Solutions
Chapter 6 Statistics A Homework 7 Solutions Ryan Rosario. A television store owner figures that 45 percent of the customers entering his store will purchase an ordinary television set, 5 percent will purchase
ST ATE PLAN UNDER TITLE XIX OF THE SOCIAL SECURITY ACT MEDICAL ASSISTANCE PROGRAM STATE OF LOUISIANA Attachment 4.19-B Item 12.a., Page 7 PAYMENTS FOR MEDICAL AND REMEDIAL CARE AND SERVICES METHODS AND
Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80)
Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80) CS 30, Winter 2016 by Prasad Jayanti 1. (10 points) Here is the famous Monty Hall Puzzle. Suppose you are on a game show, and you
ASocialMechanismofReputationManagement inelectroniccommunities 446EGRC,1010MainCampusDrive BinYuandMunindarP.Singh? DepartmentofComputerScience NorthCarolinaStateUniversity fbyu,[email protected] Raleigh,NC27695-7534,USA
CS473 - Algorithms I
CS473 - Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm View in slide-show mode 1 Reminder: Merge Sort Input array A sort this half sort this half Divide Conquer merge two sorted halves Combine
The Exponential Distribution
21 The Exponential Distribution From Discrete-Time to Continuous-Time: In Chapter 6 of the text we will be considering Markov processes in continuous time. In a sense, we already have a very good understanding
INTERNATIONAL UNIVERSITY COLLABORATION CENTRE
INTERNATIONAL UNIVERSITY COLLABORATION CENTRE B.S. B E B.S. B E (Ev O) B.S. Cv E B.S. Cv E (Ev O) B.S. C E B.S. E E B.S. M E B.S. M E (A O) B.S. M E (Mf O) V I D P Uv f M F f E T & B Ev @ UCSI Uv T F f
14. Nonlinear least-squares
14 Nonlinear least-squares EE103 (Fall 2011-12) definition Newton s method Gauss-Newton method 14-1 Nonlinear least-squares minimize r i (x) 2 = r(x) 2 r i is a nonlinear function of the n-vector of variables
VERTICES OF GIVEN DEGREE IN SERIES-PARALLEL GRAPHS
VERTICES OF GIVEN DEGREE IN SERIES-PARALLEL GRAPHS MICHAEL DRMOTA, OMER GIMENEZ, AND MARC NOY Abstract. We show that the number of vertices of a given degree k in several kinds of series-parallel labelled
MyOWNMcMaster Degree Pathway: Diploma in Business Administration & Bachelor of Arts in History
MyOWNMcMaster Degree Pathway: Diploma in Business Administration & Bachelor of Arts in History Requirements The MyOWNMcMaster degree pathway has three parts: diploma, elective and undergraduate courses.
Manual for SOA Exam MLC.
Chapter 4. Life Insurance. Extract from: Arcones Manual for the SOA Exam MLC. Fall 2009 Edition. available at http://www.actexmadriver.com/ 1/44 Properties of the APV for continuous insurance The following
Requirements The MyOWNMcMaster degree pathway has three parts: diploma, elective and undergraduate courses.
MyOWNMcMaster Degree Pathway: Diploma in Business Administration with a Concentration in Marketing & Bachelor of Arts in History Requirements The MyOWNMcMaster degree pathway has three parts: diploma,
The MyOWNMcMaster degree pathway has three parts: diploma, elective and undergraduate courses.
MyOWNMcMaster Degree Pathway: Diploma in Human Resources Management & Bachelor of Arts in History Requirements 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
Real-time Streaming Analysis for Hadoop and Flume Aaron Kimball odiago, inc. OSCON Data 2011 The plan Background: Flume introduction The need for online analytics Introducing FlumeBase Demo! FlumeBase
Solving Systems of Linear Equations
LECTURE 5 Solving Systems of Linear Equations Recall that we introduced the notion of matrices as a way of standardizing the expression of systems of linear equations In today s lecture I shall show how
W Cisco Kompetanse eek end 2 0 0 8 SMB = Store Mu ll ii gg hh eter! Nina Gullerud ng ulleru@ c is c o. c o m 1 Vår E n t e r p r i s e e r f a r i n g... 2 S m å o g M e llo m s t o r e B e d r i f t e
FUNCTIONAL PROGRAMMING
FUNCTIONAL PROGRAMMING User-defined Data Types Prof. Clarkson Summer 2015 Today s music: Pokémon Theme by Jason Paige Review Yesterday: New idioms and library functions: Map, fold, and other higher-order
Table of Contents. This file contains the following documents in the order Fsted:
Table of Contents State/Territory N arne: California State Plan Amendment (SPA) #: 12-00lB This file contains the following documents in the order Fsted: 1) Approval Letter 2) CMS 179 Form/Summary Form
Lecture 22: C Programming 4 Embedded Systems
Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human
INTEGRATING FACTOR METHOD
Differential Equations INTEGRATING FACTOR METHOD Graham S McDonald A Tutorial Module for learning to solve 1st order linear differential equations Table of contents Begin Tutorial c 2004 [email protected]
Algebraic Structures II
MAS 305 Algebraic Structures II Notes 12 Autumn 2006 Factorization in integral domains Lemma If a, b, c are elements of an integral domain R and ab = ac then either a = 0 R or b = c. Proof ab = ac a(b
Mathematical Expectation
Mathematical Expectation Properties of Mathematical Expectation I The concept of mathematical expectation arose in connection with games of chance. In its simplest form, mathematical expectation is the
A Uniform Asymptotic Estimate for Discounted Aggregate Claims with Subexponential Tails
12th International Congress on Insurance: Mathematics and Economics July 16-18, 2008 A Uniform Asymptotic Estimate for Discounted Aggregate Claims with Subexponential Tails XUEMIAO HAO (Based on a joint
Figure2:Themixtureoffactoranalysisgenerativemodel. j;j z
TheEMAlgorithmforMixturesofFactorAnalyzers DepartmentofComputerScience ZoubinGhahramani GeoreyE.Hinton May21,1996(revisedFeb27,1997) TechnicalReportCRG-TR-96-1 Email:[email protected] Toronto,CanadaM5S1A4
Portfolio Distribution Modelling and Computation. Harry Zheng Department of Mathematics Imperial College [email protected]
Portfolio Distribution Modelling and Computation Harry Zheng Department of Mathematics Imperial College [email protected] Workshop on Fast Financial Algorithms Tanaka Business School Imperial College
M/M/1 and M/M/m Queueing Systems
M/M/ and M/M/m Queueing Systems M. Veeraraghavan; March 20, 2004. Preliminaries. Kendall s notation: G/G/n/k queue G: General - can be any distribution. First letter: Arrival process; M: memoryless - exponential
DistributedSharedMemorySystems? AdaptiveLoadBalancinginSoftware CompilerandRun-TimeSupportfor SotirisIoannidisandSandhyaDwarkadas fsi,[email protected] DepartmentofComputerScience Rochester,NY14627{0226
Printing Letters Correctly
Printing Letters Correctly The ball and stick method of teaching beginners to print has been proven to be the best. Letters formed this way are easier for small children to print, and this print is similar
1 Interest rates, and risk-free investments
Interest rates, and risk-free investments Copyright c 2005 by Karl Sigman. Interest and compounded interest Suppose that you place x 0 ($) in an account that offers a fixed (never to change over time)
SF2940: Probability theory Lecture 8: Multivariate Normal Distribution
SF2940: Probability theory Lecture 8: Multivariate Normal Distribution Timo Koski 24.09.2015 Timo Koski Matematisk statistik 24.09.2015 1 / 1 Learning outcomes Random vectors, mean vector, covariance matrix,
MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 14 10/27/2008 MOMENT GENERATING FUNCTIONS
MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 14 10/27/2008 MOMENT GENERATING FUNCTIONS Contents 1. Moment generating functions 2. Sum of a ranom number of ranom variables 3. Transforms
Architectural Analysis of Microsoft Dynamics NAV
Architectural Analysis of Microsoft Dynamics NAV Tom Hvitved [email protected] Department of Computer Science University of Copenhagen 3gERP Workshop, November 18th 2008 Outline 1 Introduction 2 Motivation
Optimization of a Combined Heat and Power Generation System with Ice Thermal Storage
Optimization of a Combined Heat and Power Generation System with Ice Thermal Storage Cheng-gang Cui, Xiao-fei Yang, Feng Tian, Ting-yu Gao and Zhi-cong Zhu Abstract This paper explores the optimization
Manual for SOA Exam MLC.
Chapter 5 Life annuities Extract from: Arcones Manual for the SOA Exam MLC Fall 2009 Edition available at http://wwwactexmadrivercom/ 1/70 Due n year deferred annuity Definition 1 A due n year deferred
A SNOWBALL CURRENCY OPTION
J. KSIAM Vol.15, No.1, 31 41, 011 A SNOWBALL CURRENCY OPTION GYOOCHEOL SHIM 1 1 GRADUATE DEPARTMENT OF FINANCIAL ENGINEERING, AJOU UNIVERSITY, SOUTH KOREA E-mail address: [email protected] ABSTRACT. I introduce
Uncertainty evaluations in EMC measurements
Uncertainty evaluations in EMC measurements Carlo Carobbi Dipartimento di Elettronica e Telecomunicazioni Università degli Studi di Firenze Istituto di Fisica Applicata "Nello Carrara" - 3 Luglio 2009
SQL Programming. CS145 Lecture Notes #10. Motivation. Oracle PL/SQL. Basics. Example schema:
CS145 Lecture Notes #10 SQL Programming Example schema: CREATE TABLE Student (SID INTEGER PRIMARY KEY, name CHAR(30), age INTEGER, GPA FLOAT); CREATE TABLE Take (SID INTEGER, CID CHAR(10), PRIMARY KEY(SID,
C Programming. Charudatt Kadolkar. IIT Guwahati. C Programming p.1/34
C Programming Charudatt Kadolkar IIT Guwahati C Programming p.1/34 We want to print a table of sine function. The output should look like: 0 0.0000 20 0.3420 40 0.6428 60 0.8660 80 0.9848 100 0.9848 120
In order to master the techniques explained here it is vital that you undertake plenty of practice exercises so that they become second nature.
The scalar product mc-ty-scalarprod-2009- Oneofthewaysinwhichtwovectorscanbecombinedisknownasthescalarproduct.When wecalculatethescalarproductoftwovectorstheresult,asthenamesuggestsisascalar,rather than
Applying Active Noise Control Technique for Augmented Reality Headphones
Applying Active Noise Control Technique for Augmented Reality Headphones Rishabh Ranjan 1 ; Gan Woon-Seng 2 ; Chong Yong-Kim 3 Digital Signal Processing Laboratory School of Electrical and Electronic Engineering,
r + s = i + j (q + t)n; 2 rs = ij (qj + ti)n + qtn.
Chapter 7 Introduction to finite fields This chapter provides an introduction to several kinds of abstract algebraic structures, particularly groups, fields, and polynomials. Our primary interest is in
MATH 381 HOMEWORK 2 SOLUTIONS
MATH 38 HOMEWORK SOLUTIONS Question (p.86 #8). If g(x)[e y e y ] is harmonic, g() =,g () =, find g(x). Let f(x, y) = g(x)[e y e y ].Then Since f(x, y) is harmonic, f + f = and we require x y f x = g (x)[e
Statistics 100A Homework 8 Solutions
Part : Chapter 7 Statistics A Homework 8 Solutions Ryan Rosario. A player throws a fair die and simultaneously flips a fair coin. If the coin lands heads, then she wins twice, and if tails, the one-half
CS 241 Data Organization Coding Standards
CS 241 Data Organization Coding Standards Brooke Chenoweth University of New Mexico Spring 2016 CS-241 Coding Standards All projects and labs must follow the great and hallowed CS-241 coding standards.
Practice problems for Homework 11 - Point Estimation
Practice problems for Homework 11 - Point Estimation 1. (10 marks) Suppose we want to select a random sample of size 5 from the current CS 3341 students. Which of the following strategies is the best:
TN No. ~,' 79n. (BPDl 4.38. Revision: HCFA-PM-91-10 DECEMBER 1991 State/Territory: (a)
-- -... -.. -- 79n Revision: HCFA-PM-91-10 (BPDl Citation and 1919(f) (2), 4.38..JL Nurse Aide Training and c0i!itency Evaluation for Nursin~ Fac~ ~ties (a) The State assures that the requirements of 42
Chapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
E2E Project Management Process Governance (Electric Capital)
Attachment AG-1-8-10 Page 1 of 10 E2E Project Management Process Governance (Electric Capital) Report No. 1332 Final Distribution Final Report Audit Team: Report Grading: Number of Findings: Date of issue
Probability density function : An arbitrary continuous random variable X is similarly described by its probability density function f x = f X
Week 6 notes : Continuous random variables and their probability densities WEEK 6 page 1 uniform, normal, gamma, exponential,chi-squared distributions, normal approx'n to the binomial Uniform [,1] random
Permanents, Order Statistics, Outliers, and Robustness
Permanents, Order Statistics, Outliers, and Robustness N. BALAKRISHNAN Department of Mathematics and Statistics McMaster University Hamilton, Ontario, Canada L8S 4K [email protected] Received: November
Vectors and Index Notation
Vectors and Index Notation Stephen R. Addison January 12, 2004 1 Basic Vector Review 1.1 Unit Vectors We will denote a unit vector with a superscript caret, thus â denotes a unit vector. â â = 1 If x is
On closed-form solutions of a resource allocation problem in parallel funding of R&D projects
Operations Research Letters 27 (2000) 229 234 www.elsevier.com/locate/dsw On closed-form solutions of a resource allocation problem in parallel funding of R&D proects Ulku Gurler, Mustafa. C. Pnar, Mohamed
( ) = 1 x. ! 2x = 2. The region where that joint density is positive is indicated with dotted lines in the graph below. y = x
Errata for the ASM Study Manual for Exam P, Eleventh Edition By Dr. Krzysztof M. Ostaszewski, FSA, CERA, FSAS, CFA, MAAA Web site: http://www.krzysio.net E-mail: [email protected] Posted September 21,
SOLVING LINEAR SYSTEMS
SOLVING LINEAR SYSTEMS Linear systems Ax = b occur widely in applied mathematics They occur as direct formulations of real world problems; but more often, they occur as a part of the numerical analysis
COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms.
COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms 1 Activation Records activation declaration location Recall that an activation
Master s Theory Exam Spring 2006
Spring 2006 This exam contains 7 questions. You should attempt them all. Each question is divided into parts to help lead you through the material. You should attempt to complete as much of each problem
... Schema Integration
DataIntegrationTechniquesbasedon MichaelGertz DataQualityAspects DepartmentofComputerScience UniversityofCalifornia,Davis IngoSchmitt [email protected] Davis,CA95616,USA OneShieldsAvenue Otto-von-Guericke-UniversitatMagdeburg
TRANSACTIONS JUNE, 1969 AN UPPER BOUND ON THE STOP-LOSS NET PREMIUM--ACTUARIAL NOTE NEWTON L. BOWERS, JR. ABSTRACT
TRANSACTIONS OF SOCIETY OF ACTUARIES 1969 VOL. 21 PT. 1 NO. 60 VOL. XXI, PART I M~TINO No. 60 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 -7.0-9.5 4.3-4.2-9.0-8.7-3.5-5.7-8.0 3.4-6.9-8.7 9.8 3.8 5.1-2.7-6.5 0.8-3.5 7.1 6.2 9.9 7.7 0.1-7.4 Site A Site B Site C
DistributedMultivariateRegressionUsing Wavelet-basedCollectiveDataMining SchoolofElectricalEngineeringandComputerScience DarylE.HershbergerandHillolKargupta SchoolofElectricalEngineeringandComputerScienceTechnicalReportEECS99-002
SF2940: Probability theory Lecture 8: Multivariate Normal Distribution
SF2940: Probability theory Lecture 8: Multivariate Normal Distribution Timo Koski 24.09.2014 Timo Koski () Mathematisk statistik 24.09.2014 1 / 75 Learning outcomes Random vectors, mean vector, covariance
Modelling Patient Flow in an Emergency Department
Modelling Patient Flow in an Emergency Department Mark Fackrell Department of Mathematics and Statistics The University of Melbourne Motivation Eastern Health closes more beds Bed closures to cause ambulance
4.1 4.2 Probability Distribution for Discrete Random Variables
4.1 4.2 Probability Distribution for Discrete Random Variables Key concepts: discrete random variable, probability distribution, expected value, variance, and standard deviation of a discrete random variable.
Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li
Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential
A mixture model for random graphs
A mixture model for random graphs J-J Daudin, F. Picard, S. Robin [email protected] UMR INA-PG / ENGREF / INRA, Paris Mathématique et Informatique Appliquées Examples of networks. Social: Biological:
3. The Economics of Insurance
3. The Economics of Insurance Insurance is designed to protect against serious financial reversals that result from random evens intruding on the plan of individuals. Limitations on Insurance Protection
Hook Lengths and Contents. Richard P. Stanley M.I.T.
Hook Lengths and Contents p. Hook Lengths and Contents Richard P. Stanley M.I.T. Hook Lengths and Contents p. Standard Young tableau standard Young tableau (SYT) of shape λ = (4, 4, 3, 1): < < 1 3 4 2
Mathematics of Life Contingencies MATH 3281
Mathematics of Life Contingencies MATH 3281 Life annuities contracts Edward Furman Department of Mathematics and Statistics York University February 13, 2012 Edward Furman Mathematics of Life Contingencies
1. Use the class definition above to circle and identify the parts of code from the list given in parts a j.
public class Foo { private Bar _bar; public Foo() { _bar = new Bar(); public void foobar() { _bar.moveforward(25); 1. Use the class definition above to circle and identify the parts of code from the list
Eigenvalues and Eigenvectors
Chapter 6 Eigenvalues and Eigenvectors 6. Introduction to Eigenvalues Linear equations Ax D b come from steady state problems. Eigenvalues have their greatest importance in dynamic problems. The solution
Statistics 100A Homework 3 Solutions
Chapter Statistics 00A Homework Solutions Ryan Rosario. Two balls are chosen randomly from an urn containing 8 white, black, and orange balls. Suppose that we win $ for each black ball selected and we
8. Matchings and Factors
8. Matchings and Factors Consider the formation of an executive council by the parliament committee. Each committee needs to designate one of its members as an official representative to sit on the council,
STAT 830 Convergence in Distribution
STAT 830 Convergence in Distribution Richard Lockhart Simon Fraser University STAT 830 Fall 2011 Richard Lockhart (Simon Fraser University) STAT 830 Convergence in Distribution STAT 830 Fall 2011 1 / 31
RANDOM VARIABLES AND PROBABILITY DISTRIBUTIONS
RANDOM VARIABLES AND PROBABILITY DISTRIBUTIONS. DISCRETE RANDOM VARIABLES.. Definition of a Discrete Random Variable. A random variable X is said to be discrete if it can assume only a finite or countable
We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded
E-R Diagram Database Development We know how to query a database using SQL A set of tables and their schemas are given Data are properly loaded But, how can we develop appropriate tables and their schema
telnetd exploit FreeBSD Telnetd Remote Exploit Für Compass Security AG Öffentliche Version 1.0 Januar 2012
telnetd exploit FreeBSD Telnetd Remote Exploit Für Compass Security AG Öffentliche Version 1.0 Januar 2012 Content Part I Info Bug Telnet Exploit Part II Advanced Exploitation Meta Information Disclosed
Improving Experiments by Optimal Blocking: Minimizing the Maximum Within-block Distance
Improving Experiments by Optimal Blocking: Minimizing the Maximum Within-block Distance Michael J. Higgins Jasjeet Sekhon April 12, 2014 EGAP XI A New Blocking Method A new blocking method with nice theoretical
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
Period Date LAB : PAPER PET GENETICS 1. Given the list of characteristics below, you will create an imaginary pet and then breed it to review the concepts of genetics. Your pet will have the following
