Similar documents

Average rate of change of y = f(x) with respect to x as x changes from a to a + h:

KeyEscrowinMutuallyMistrustingDomains?

Thepurposeofahospitalinformationsystem(HIS)istomanagetheinformationthathealth

Internet!of!Services! Project!IntroducMon!

GContracts Programming by Contract with Groovy. Andre Steingress

Ordering Constraints on Trees


All of my instructors showed a true compassion for teaching. This passion helped students enjoy every class. Amanda


Introduction to Apache Pig Indexing and Search

How do we build good strategic partnerships? GUNILLA CARLECRANTZ, SENIOR ADVISOR EXTERNAL RELATIONS


Linear Programming Notes V Problem Transformations

Appendix... B. The Object Constraint

Rules Variation Summary for 2014 Master of Teaching (Secondary) Implications for current Master of Teaching (Secondary) students Note unit change

Note on some explicit formulae for twin prime counting function

Introduction to Python


KEY ELEMENTS TO DESIGN AN EXTERNAL ACTIVE MANAGEMENT PROGRAM. Alejandro C. Reveiz H. Director, Quantitative Solutions, SAA & Analytics (QSA)

Problem Set #3 Answer Key

Number of objects k 2k 4k 8k 16k 32k 64k 128k256k512k 1m 2m 4m 8m

CORRELATION ANALYSIS

b) since the remainder is 0 I need to factor the numerator. Synthetic division tells me this is true

7.1 Our Current Model

Name: ID: Discussion Section:

Algebra III. Lesson 33. Quadrilaterals Properties of Parallelograms Types of Parallelograms Conditions for Parallelograms - Trapezoids

Simple Graphs Degrees, Isomorphism, Paths


Examples of Tasks from CCSS Edition Course 3, Unit 5

Materials Management and Inventory Systems


Start Here. Installation Guide. Rosetta Stone Standalone License. This Guide Will Show You How To: Install the Student Management System...

(a) We have x = 3 + 2t, y = 2 t, z = 6 so solving for t we get the symmetric equations. x 3 2. = 2 y, z = 6. t 2 2t + 1 = 0,

!NAVSEC':!A!Recommender!System!for!3D! Network!Security!Visualiza<ons!

Variable Neighbourhood Search for the Global Optimization of Constrained NLPs

threads threads threads

Abstract.Weproposetimed(nite)automatatomodelthebehaviorofrealtimesystemsovertime.Ourdenitionprovidesasimple,andyetpowerful,wayto

Solver- aided DSL with. Rui Zhao (rz2290)

Cumulative cost. Progress through steps. Risk analysis. Risk analysis. Risk analysis. Protot. Protot. 3. Concept. A Protot.

Understanding FX Forwards. A Guide for Microfinance Practitioners

Math 53 Worksheet Solutions- Minmax and Lagrange

1. Supply and demand are the most important concepts in economics.

Last not not Last Last Next! Next! Line Line Forms Forms Here Here Last In, First Out Last In, First Out not Last Next! Call stack: Worst line ever!

Sample Questions Csci 1112 A. Bellaachia

Abstract. 1IntroductionandMotivation

Introduction to Functional Verification. Niels Burkhardt

Optimal Resource Allocation for the Quality Control Process

Announcements FORTRAN ALGOL COBOL. Simula & Smalltalk. Programming Languages

Conference Call Q1-2015/2016

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Specification and Validation of Telephone Systems in LOTOS 1,2

Prot Maximization and Cost Minimization

Most limiting amino acid concept...

Structured Representation Models. Structured Information Sources

Relational model. Relational model - practice. Relational Database Definitions 9/27/11. Relational model. Relational Database: Terminology

Data Mining. 1 Introduction 2 Data Mining methods. Alfred Holl Data Mining 1

Advanced Pig (or "we're not in Kansas anymore") Set operations in Map/Reduce How to parameterize an operation The oxymoron called "Pig Efficiency"


to TMS 4.0 in an Integrated OC Environment

ALGEBRA I (Common Core)

Nonlinear Programming Methods.S2 Quadratic Programming

Thales global payment card program

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June Dr.-Ing.

Optimization under fuzzy if-then rules

Lecture 6: Finite Fields (PART 3) PART 3: Polynomial Arithmetic. Theoretical Underpinnings of Modern Cryptography

CSSE 372 Software Project Management: Software Estimation With COCOMO-II

Moving your money forward, at rates you want. dvfx Manual

Applied Math 247 Exam#1: Summer 2008

CISC 322 Software Architecture

Chapter 7. Homotopy. 7.1 Basic concepts of homotopy. Example: z dz. z dz = but

Constrained Optimization: The Method of Lagrange Multipliers:

Monitoring Network Traffic with Radial Traffic Analyzer

Binary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *

Transcription:

InclusionConstraintsover MartinMuller1,JoachimNiehren1andAndreasPodelski2 Non-emptySetsofTrees? UniversitatdesSaarlandes,66041Saarbrucken,Germany ImStadtwald,66123Saarbrucken,Germany 2Max-Planck-InstitutfurInformatik, fmmueller,niehreng@ps.uni-sb.de 1ProgrammingSystemLab, Abstract.WepresentanewconstraintsystemcalledINES.Itsconstraintsareconjunctionsofinclusionst1t2betweenrst-orderterms podelski@mpi-sb.mpg.de (withoutsetoperators)whichareinterpretedovernon-emptysetsof trees.theexistingsystemsofsetconstraintscanexpressinesconstraintsonlyiftheyincludenegation.theirsatisabilityproblemis NEXPTIME-complete.Wepresentanincrementalalgorithmthatsolves programminglanguage. toapplyinesconstraintsfortypeanalysisforaconcurrentconstraint thesatisabilityproblemofinesconstraintsincubictime.weintend Sets)andpresentanincrementalalgorithmtodecidethesatisabilityofINES 1Introduction WeproposeanewconstraintsystemcalledINES(InclusionsoverNon-Empty constraintsintimeo(n3).inesconstraintsareconjunctionsofinclusionst1t2 betweenrst-orderterms(withoutsetoperators)whichareinterpretedoverthe t16;^t1t2issatisableoverarbitrarysets.notethattheconstraintt6; AnINES-constraintt1t2issatisableovernon-emptysetsifandonlyif innitetrees.allgivenresultscanbeeasilyadaptedtonitetrees. domainofnon-emptysetsoftrees.inthispaperwefocusonsetsofpossibly cannotbeexpressedbypositivesetconstraintsonly[16].theexpressivenessof INESconstraintsissubsumedbythatofsetconstraintswithnegation[9,16].In thecaseofnitetrees,thesatisabilityproblemofsetconstraintswithnegation isknowntobedecidable[1,13];itiscompletefornondeterministicexponential time[9,10].thisresultimpliesthatthesatisabilityproblemofinesconstraints WecharacterizethesatisabilityofINESconstraintsbyasetofaxiomssuchthat aninesconstraintissatisableovernon-emptysetsifandonlyifitissatisable hasnotbeenconsideredbefore. oversetsofnitetreesisdecidable.thecorrespondingproblemforinnitetrees?asummaryhasappearedin:maxdauchet,ed.,proc.ofcaap'97aspartof TAPSOFT'97,TheoryandPracticeofSoftwareDevelopment.April1997,Lille,France.

closesagiveninputconstraintunderitsconsequenceswithrespecttotheaxioms. insomemodeloftheseaxioms.theseaxiomsdeneaxpointalgorithmthat Weprovethataconstraint'issatisableifandonlyifthealgorithmwith formulaeinterpretedovertreesandovernon-emptysetsoftreesareclosely SetsversusTrees.Thesatisabilityproblemsofseveralclassesofrst-order willbediscussedlaterinthisintroduction. input'doesnotderive?asaconsequenceof'.allaxioms(forinnitetrees) related.thefollowingtwoinstancesofthisobservationhaveinspiredourchoice ofaxiomsorunderlyourproofs. Equalityconstraintsareconjunctionsofequationst1=t2betweenrst-order oftherst-ordertheoryofequalityconstraintsovertrees[18,19,12]sinceits non-emptysetsoftreescoincide.thisfollowsfromthecompleteaxiomatization ordertheoriesofequalityconstraintsovertreesandofequalityconstraintsover symmetryofsetinclusion(t1=t2$t1t2^t2t1).actually,eventherst- terms.oversets,theycanbeexpressedbyinclusionconstraintsduetoanti- axiomsalsoholdovernon-emptysetsoftrees(butdon'toverpossiblyempty sets). ThereexistsanaturalinterpretationofINES-constraintovertreelikestructures thatwecalltreeprexes.inadierentcontext[6]treeprexesarecalledbohm trees(without-binders).treeprexescomewithanaturalorderingrelation overtreeprexes(wheretheinclusionsymbolisinterpretedastheinverseofthe wheretheemptytreeprexisthegreatestelement.weprovethatanines constraintissatisableovernon-emptysetsoftreesifandonlyifitissatisable formulatedforabinaryfunctionsymbolf). oftheinclusionrelation.wealsoassumethefollowingdecompositionaxiom(here Axioms.Thersttwoaxiomsweneedpostulatethereexivityandtransitivity prexorderingontreeprexes). Thisaxiomholdsovernon-emptysetsoftreesbutnotoverpossiblyemptysets, sinceeveryvariableassignmentwith(x)=;or(y)=;isasolutionof f(x;y)f(x0;y0)!xx0^yy0 f(x;y)f(x0;y0)butnotnecessarilyofxx0^yy0.ananalogousstatement holdsforthefollowingclashaxiom. Forinstance,theunsatisabilityoftheconstraint'givenbyxg(x)^xg(y)^ yz^zaisnotderivablewiththeseaxiomsalone.weneedfurtheraxioms TheseaxiomsdonotsucetocharacterizethesatisabilityofINESconstraints. f(x;y)g(x0;y0)!? forf6=g thatusenon-disjointnessconstraintst16jt2denedast1\t26;.forthenondisjointnessrelationwerequirereexivityandsymmetryandadecompositionaxiomasfortheinclusionrelation. f(y;z)6jf(y0;z0)!y6jy0^z6jz0 2

Finally,weassumeaclashaxiomsimilartotheoneforinclusionandrequire nondisjointnesstobecompatiblewithinclusioninthefollowingsense. Nowreconsidertheconstraint'givenaboveandobservethatwecanderive x6jz^xy!y6jz x6jxbyreexivity,thenx6jybydecomposition,andx6jzbycompatibility.this AlgorithmandComplexity.Theaboveaxiomsyieldanalgorithmthatadds yieldsaclashwithxg(x)^za. constraintsoftheformxy,x6jytoagiveninputconstraint'until'isclosed underallaxiomsorimplies?.theinesconstraintxt1^:::^xtnexpresses x1\:::\xk6;(whichcanbeexpressedbytheformula9y(yx1^:::^yxk)) thensetsdenotedbythetermst1;:::;tnhaveanon-emptyintersection.fortunately,itisnotnecessarytoaddk-arynon-disjointnessconstraintsoftheform ofwhichthereareexponentiallymany.instead,ouralgorithmaddsatmost O(n2)constraintstotheinputconstraint',wherenisthenumberofvariables timeo(n).thisyieldsanimplementationofouralgorithmwithtimecomplexity in'.theadditionofasingleconstraintcanbeimplementedsuchthatitcosts TypeAnalysis.OneapplicationforINESconstraintswhichweareinvestigatingin[23]istypeanalysisforconcurrentconstraintprogramming[17,27],in O(n3).Thisimplementationcanbeorganizedincrementally. anerrorifthesetofpossiblerun-timevaluesisemptyforsomevariable.this INESallowsaninterpretationoversetsofpossiblyinnitetrees.Itisconsidered programvariables.sincevaluesinozincludeinnitetrees,itisimportantthat There,INESconstraintsareusedtoapproximatethesetofrun-timevaluesfor particularoz[28].asformalfoundationsweintendtousethecalculiin[24,25]. factwasourinitialmotivationforthechoiceofnon-emptysetsoftreesasthe PlanofthePaper.InSection2,wediscussrelatework.InSection3,we denethesyntaxandsemanticsofinesconstraintsandinsection4,wepresent interpretationdomainforinesconstraints. theaxiomsandthealgorithm.insection5,weprovethecompletenessofour thedetailsoftheproofsintheconferenceversionofthepaper. algorithm.insection6,wecomparetheinterpretationsofinesconstraintsover treeprexesandovernon-emptysetsoftrees.duetospacelimitations,weomit AppendixAgivesanexampleillustratingprogramanalysisforOzwithINES constraints.appendixbcontainstheomittedproofs.appendixcdetailshow ofatomicsetconstraints(standardsetconstraintswithoutsetoperatorsand toimplementthealgorithmwithincrementalo(n3)complexity.inappendixd, negation)isinvariantwithrespecttothechoiceofniteorinnitetrees. withexplicitnon-emptinessconstraintsx6;.wealsoprovethatsatisability ofstandardsetconstraints(interpretedoverpossiblyemptysetsofnitetrees) weadaptthealgorithmtothenite-treecase,andinappendixetoasubclass 3

2RelatedWork StandardSetConstraints.Setconstraintsasin[2,5,10,15]areinclusions Ouralgorithmcanbeadaptedsuchthatitsolvesasubclassofsetconstraints betweenrst-ordertermswithsetoperatorsinterpretedoversetsofnitetrees. withoutsetoperatorsincubictime(seeappendixe).thegeneralcaseisnondeterministicallyexponentialtimecompleteasprovedin[1,13].thesubclass thatwecansolveincubictimesyntacticallyextendstheinesconstraintswith explicitnon-emptinessconstraintx6;(seeappendixe).notethatthesatisabilityofthesesetconstraintsdependsonthechoiceofniteorinnitetrees (considerxf(x)^x6;),whichisincontrasttostandardsetconstraintswithout negation.ouralgorithmaccountsfornitenessthroughtheoccurcheck. AtomicSetConstraints.HeintzeandJaarconsiderso-calledatomicset constraints[15]whichsyntacticallycoincidewithinesconstraintsbutareinterpretedoverpossiblyemptysetsofnitetrees.thesatisabilityproblemfor SetConstraintsforTypeAnalysis.Aikenetal.[3,4]useconstraints resultsof[14]and[15].anexplicitproofisgiveninappendixeofthispaper. overspecicsetsoftreescalled\types"forthetypeanalysisoffl.thereisa atomicsetconstraintsisalsoo(n3).thisresultisimplicitinthecombined minimaltype0which{intermsofconstraintsolving{behavesjustlikethe emptysetinstandardsetconstraints(althoughitisnotanemptysetfromthe typespointofviewbutcontainsavaluedenotingnon-termination).incontrast followingconstraintsimplicationrulebydroppingthedisjunctsinbrackets[4]. intersection.oneoftheoptimizationsusedbyaikenetal.istostrengthenthe totheconstraintsofthispaper,theirsetconstraintsprovideforunionand Asstatedin[4],thisoptimizationdoesnotpreservesoundness(f(a;0)f(b;0) holdsbutab^00doesnot).itmightbepossibletojustifyitbyusingnonemptysetsasinterpretationdomain.thisislefttofurtherresearch. Podelski[11]giveanalgorithmwhichdecidestheentailmentproblembetween INESconstraintswheninterpretedoversetsofnitetrees.Theyalsodecidethe EntailmentandIndependenceforInesConstraints.Charatonikand in[11]donotincludeanyoftheresultspresentedheresincetheyuseasan satisabilityofinesconstraintswithnegationinthenitetreecase.theresults explicitprerequisitethefactthatsatisabilityofinesconstraintsisdecidable. f(x;y)f(x0;y0)!xx0^yy0[_x0_y0] thetwosatisabilityproblemsareratherdierentproblemssincetarskianset TarskianSetConstraints.MacAllesterandGivan[21]giveacubicalgorithm whichdecidessatisabilityforaclassoftarskiansetconstraints[22],andwhich alsocontainsanon-disjointnessconstraint.apartfromthissyntacticsimilarity, constraintsarenotinterpretedoverthedomainoftrees(thisisalsoobserved in[22]).arelatedopenquestioniswhetherouraxiomsdenealocaltheory[20, 8],whichwouldalsoproofthecubiccomplexityboundofouralgorithm. 4

asetoffunctionsymbolsf;gandtheirrespectivearityn0.constants(i.e. Weassumeasetofvariablesrangedoverbyx;y;zandasignaturethatdenes 3SyntaxandSemanticsofInesConstraints functionsymbolsofarity0)aredenotedwithaandb. Trees.Webasethedenitionoftreesonthenotionofpathssincewewishto includeinnitetrees.pathswillturnoutcentralforourproofsinsection5.a pathpisasequenceofpositiveintegersrangedoverbyi;j;n;m.theemptypath isdenotedby".wewritethefree-monoidconcatenationofpathspandqaspq; wehave"p=p"=p.givenpathspandq,qiscalledaprexofpifp=qp0for somepathp0. Letbeasetofpairs(p;f)ofpathspandfunctionsymbolsf.Wesaythat isprexclosed,if(p;f)2andqisaprexofpimpliesthatthereisagsuch that(q;g)2.itispathconsistent,if(p;f)2and(p;g)2impliesf=g. Wecallarityconsistent,if(p;f)2,(pi;g)2impliesthati2f1;:::;ng providedthearityoffisn.finally,iscalledaritycomplete,if(p;f)2, wherethearityoffisn,impliesforalli2f1;:::;ngtheexistenceofagwith (pi;g)2. A(possiblyinnite)treeisasetofpairs(p;f)thatisnon-empty,prexclosed, aritycomplete,pathconsistent,andarityconsistent.thesetofall(possibly InesConstraints.AnINESconstraintt1t01^:::^tnt0nisaconjunctionof treesbyp+(tree). innite)treesoverisdenotedbytreeandthesetofallnon-emptysetsof inclusionsbetweenrst-ordertermstdenedbythefollowingabstractsyntax. implicitlythatthelengthoftcoincideswiththearityoff.weinterpretines Hereandthroughoutthepaper,tstandsforasequenceoftermsandweassume constraintsoverthestructurep+(tree)ofnon-emptysetsoftrees.inthisstructure,afunctionsymbolfofisinterpretedaselementwisetreeconstructor andtherelationsymbolassubsetrelation.wecallarst-orderformulaover INESconstraintsatisableifitissatisableinthestructureP+(Tree).TworstorderformulaeoverINESconstraintsarecalledequivalentiftheyareequivalently interpretedinp+(tree). t::=xjf(t) inclusionsxf(y)andf(y)x(thisisamatteroftaste).andthird,weneed insteadofpossiblydeeptermst.second,weuseequalitiesx=f(y)ratherthan binarynon-disjointnessconstraintsx6jy.theirsemanticsisgivenbytheequivalencetotheformulax\y6;oversetsoftrees.overnon-emptysetsoftrees,x6jstraintsyntaxinthesequel.first,werestrictourselvestoattermsf(x)andx FlatInesConstraints.Foralgorithmicreasons,weuseanalternativecon- 5

isequivalentto9z(zx^zy).crucially,however,nondisjointnessconstraints x6jyavoidexplicitexistentialquanticationinouralgorithm. junction,i.e.,weconsider'asamultisetofinclusionsxy,equalitiesx=f(y), WeidentifyatINESconstraints'uptoassociativityandcommutativityofcon- ThesethreestepsleadustoatINESconstraints'denedasfollows. andnon-disjointnessconstraintsx6jy. '::='1^'2jxyjx=f(y)jx6jy Fromnowon,wewillconsideronlyatINESconstraintsandcallthemconstraintsforshort.ThisisjustiedbythefollowingProposition.Letthesize ofaconstraint'bethenumberoffunctionsymboloccurrencesplusvariable Proposition1.ThesatisabilityproblemsofINESconstraintsandofatINES occurrencesin'. 4AxiomsandAlgorithm constraintshavethesametimecomplexityuptoalineartransformation. WepresentasetofaxiomsvalidforINES-constraintsinterpretedovernon-empty solvesthesatisabilityproblemofinesconstraints.thecorrectnessandthe setsoftrees.inasecondstep,weinterprettheseaxiomsasanalgorithmthat A1.xxandxy^yz!xz complexityofthisalgorithmwillbeprovedinsection5. A2.x=f(y)^xx0^x0=f(z)!yz A5.x=f(y)^x6jx0^x0=f(z)!y6jz A3.xy!x6jyandxy^x6jz!y6jzandx6jy!y6jx A4.x=f(y)^x6jx0^x0=g(z)!?forf6=g Table1containsverulesA1-A5representingsetsofaxioms.1Theunionof Table1.AxiomsofINESconstraintsovernon-emptysetsofinnitetrees thesesetsisdenotedbya.forinstance,arulexxrepresentstheinniteset 1Notethattheseaxiomsdierfromtheonesgivenintheintroduction.Theconstraints usedtherearenotatandthevariable-variablecasexyandx6jyareomitted. Indeed,theaxiomsintheintroductionaresemanticallycomplete,althoughthisis non-trivialtoseeanddependsonthecorrectnessofthealgorithmpresentedhere. 6

ofaxiomsthatisobtainedbyinstantiationofthemetavariablexwithconcrete Proposition2.ThestructureP+(Tree)isamodeloftheaxiomsinA. constraints'! variables.notethatanaxiomiseitheraconstraint',animplicationbetween,oranimplication'!?. Proof.Byaroutinecheck.Wenotethatthenon-emptinessassumptionof P+(Tree)isessentialforaxiomsA2andA3:1. TheAlgorithm.ThesetofaxiomsAcanbeconsideredasa(nave)xed pointalgorithmathat,givenaninputconstraint',iterativelyaddslogical 2 consequencesofa[f'gto'.moreprecisely,ineverystepainputsaconstraint' possibleif?takesplaceifthereexists andeitherterminateswith?oroutputsaconstraint'^ 02'suchthat 0!?2A.Outputof'^.Terminationwith Example1.Arsttypeofinconsistencydependsonthetransitivityofsetinclusion.Hereisatypicalexample: 2Aorthereexists 0in'with 0! with?bya4. AlgorithmAmayaddxzbyA1:2,thenx6jzwithA3:1,andthenterminate x=a^xy^yz^z=b!? fora6=b disjointnessrequirements.forillustration,weconsider: Example2.Asecondtypeofinconsistencycomeswithimplicitorexplicitnon- AlgorithmAmayaddz6jxbyA3:1,thenx6jzviaA3:3,thenx6jywithA3:2,and nallyterminatewith?viaa4. x=a^zx^zy^y=b!?for fora6=b reasoningwitha2.consider: Example3.Inconsistenciesoftheabovetwotypesmaybedetectedbystructural AlgorithmAmayaddxxbyA1:1,thenxzwithA2,thenx6jzbyA3:1,and nallyterminatewith?witha4. x=f(x)^x=f(z)^z=a!? Example4.WeneedanotherstructuralargumentbasedonA5forderivingthe unsatisabilityofthefollowingconstraint. AlgorithmAmayaddx6jyafterseveralstepsasshowninExample2.Thenit mayproceedwithx6jx0viaa5andterminatewith?viaa4. x=f(x)^zx^zy^y=f(x0)^x0=a!? 7

Termination. straintsx6jyandxyto'whicharenotcontainedin'.wealsorestrictre- addingasimplecontrol.givenaninputconstraint',weaddonlysuchcon- exivityofinclusionxxtosuchvariablesxoccurringin'.givenasubsets ofa,aconstraint'iscalleda0-closed,ifalgorithmaunderthegivencontrol AlgorithmAcanbeorganizedinaterminatingmannerby notcontain?bydenition.)thisdenesthenotionofa-closednessbutalsoof andrestrictedtotheaxiomsina0cannotproceed.(notethatconstraintsdo A1-closedness,A2-closedness,etc.,whichwillbeneededlateron. Example5.Ourcontroltakescareofterminationinpresenceofcycleslike x=f(x).forinstance,thefollowingconstraintisa-closed. Inparticular,A2andA5donotloopthroughthecyclex=f(x)innitelyoften. Proposition3.If'isaconstraintwithmvariablesthenalgorithmAwith x=f(x)^xy^y=f(x)^xx^yy^x6jx^y6jy^x6jy^y6jx Proof.SinceAdoesnotintroducenewvariables,itmayaddatmostm2nondisjointnessconstraintsx6jyandm2inclusionsxy. 2 TheproofofthisstatementisthesubjectofSection5.There,weconstructthe Proposition4.EveryA-closedconstraint'issatisableoverP+(Tree). input'terminatesundertheabovecontrolinatmost2m2steps. (oineandonline)wherenistheconstraintsize. generaldonothaveasmallestsolution(considerxf(xy)). Theorem5.ThesatisabilityofINESconstraintscanbedecidedintimeO(n3) greatestsolutionforasatisableconstraint(lemma9).notethatconstraintsin control(proposition3),thisyieldsaeectivedecisionprocedure.thecomplexitystatementisprovedinproposition14.themainideaisthateverystepof implementationofalgorithma.itexploitsthatalgorithmaleavestheorder unspeciedinwhichaxiomsinaareapplied. algorithmacanbeimplementedintimeo(n)andthatthereareo(n2)steps (Proposition3).2IntheproofofProposition14,wepresentanincremental ThereisaclassofconstraintsonwhichalgorithmAindeedtakescubictime, namelytheinclusionscyclesx1x2^:::^xn?1xn^xnx1wheren1.the closureunderaisthefulltransitiveclosurevfxixjji;j2f1:::nggplusthe 2 with?.proposition4provesthat'issatisableifastartedwith'terminates Proof.Proposition2showsthat'isunsatisableifAstartedwith'terminates withaconstraint.sinceaterminatesforallinputconstraintsundertheabove correspondingnon-disjointnessconstraints. 2EverystepofalgorithmAcoststimeO(n)onlywithrespecttoanamortizedtime analysis,whichwedonotmakeexplicitinourcomplexityproof. 8

inproposition4.wehavetoconstructasolutionforeverya-closedconstraint. 5Completeness ThegoalofthisSectionistoprovethecompletenessofouralgorithmasstated TheideaistoconstructsolutioninasubstructureofP+(Tree)thestructureof treeprexes. TreePrexes.Atreeprexisasetofpairs(p;f)thatisprexclosed,path overtreeprexessuchthatprexbecomesastructure.functionsymbolsf2 alltreeprexesisdenotedbyprex.wecannaturallyinterpretinesconstraints consistent,andarityconsistent.notethateverytreeisatreeprex.thesetof areinterpretedastreeprexconstructors(generalizingtreeconstructors).the inclusionsymbolisinterpretedastheinvertedsubsetrelationontreeprexes thatwedenotewith(i.e.,12i12).therelation16j2holdsover Prexi1[2ispathconsistent(andhenceatreeprex). dingtrees:prex!p+(tree)givenby: Proposition6.PrexisasubstructureofP+(Tree)withrespecttotheembed- Proof.ThemappingTreesisahomomorphismwithrespecttofunctionsymbolsf2andtherelationsymbolsand6j. Trees()=f0j0isatreesuchthat0g Corollary7.IfaconstraintissatisableoverPrexthenitissatisableover P+(Tree). 2 Aconjunctionofsuchconstraintsissatisableifallconjunctsaresatisable.2 PathReachability. Proof.Forconstraintsxy,x=f(y),andx6jy,thisfollowsfromProposition6. constraint',wedeneabinaryrelation';p,wherex';pyreadsas\yis thenotionofpathconsistencywithrespecttoconstraints.forallpathspand reachablefromxoverpathpin'": Weintroducethepathreachabilityrelations';pand x';"yifxyin' Wedenerelationsx';pfmeaning\fcanbereachedfromxviapathpin'": x';iyiifx=f(y1:::yi:::yn)in'; x';pqyifx';puandu';qy: Forexample,if'istheconstraintxy^y=f(u;z)^z=g(x)thenthefollowing reachabilityfromxrelationshipshold:x';"y,x';2z,x';21x,x';21y,etc., aswellasx';"f,x';2g,x';21f,etc. x';pfifx';pyandy=f(u)in'; 9

Denition8PathConsistency.Wecallaconstraint'pathconsistentifthe followingtwoconditionsholdforallx,y,p,f,andg. Lemma9.EveryA1-A2-closedandpathconsistentconstraintissatisableover 1.Ifx';pg,xx,andx';pfthenf=g. Prex. 2.Ifx';pg,x6jy,andy';pfthenf=g. ProofofProposition4.WehavetoshowthateveryA-closedconstraint'is andhencesatisableinp+(tree)bycorollary7. satisable.'ispathconsistentbylemma10,satisableinprexbylemma9, Lemma10.EveryA3-A5-closedconstraintispathconsistent. 6Non-EmptySetsversusTrees 2 Theorem11.GivenanINESconstraints',thefollowingthreestatementsare interpretationovertrees. emptysetsoftrees.forthefragmentofequalityconstraintswealsoconsideran WediscussinterpretationsofINESconstraintsovertreeprexesandovernon- equivalent: 1.'issatisable(overP+(Tree)). Proof.1)to3).If'issatisableoverP+(Tree),thenitissatisableinsome 3.'issatisableinsomemodeloftheaxiomsinA. 2.'issatisableoverPrex. 3)to2).Let'besatisableinsomemodelofA.AlgorithmAterminateswhen modelofa,sincep+(tree)isamodelofabyproposition2. 2)to1).If'issatisableoverPrexthenitissatisablebyCorollary7. startedwith'byproposition3.itoutputsaconstraint isequivalentto'inallmodelsofa. PrexbyLemmata9and10. isa-closedandhencesatisableover (andnot?)that ingisantisymmetric(x=y$xy^yx). P+(Tree),equalitiescanbeexpressedbyinclusionssincetheinclusionorder- Anequalityconstraintisaconjunctionofequalitiesx=yandx=f(y).Over 2 Theorem12.Thethreerst-ordertheoriesofequalityconstraintsovernonemptysetsoftrees,overtreeprexes,andovertreescoincide(i.e.,ofthestructuresP+(Tree),PrexandTree).3 3Independently,A.ColmerauerobservedthisforP+(Tree)andTree(pers.comm.). 10

equality. isimmediatesincetheyarealreadycontainedinawithinclusionreplacedfor Proof.Thisfollowsfromthefactthatallaxiomsofthecompleteaxiomatization oftrees[18,19,12]arevalidfornon-emptysetsoftrees.thisholdsfortheaxioms oftheform8y9!x(x1=f1(xy)^:::^xn=fn(xy)).validityoftheotheraxioms structuresp+(tree)andprex.aformulathatholdsoverprexbutnotover Incontrast,rst-orderformulaeoverinclusionconstraintscandistinguishthe P+(Tree)isgivenby 2 partialordersin[6]). wherea6=b.anotherformuladistinguishingbothstructurescomeswitha constraint-basedreformulationofthecoherenceproperty(denedforcomplete 8x(ax^bx!8y(yx)) Wesaythatanorderingrelationsatisesthecoherencepropertyifitsatisesthe thegivenordering).vi;j2i9z(zxi^zxj)!9z(vi2izxi) followingformulaeforallnitesetsi(whereinclusionsymbolisinterpretedas propertydoesnothold.thereitstatesthenon-emptinessofann-intersection Thisformulastatesthatforallvariableassignmenttheelementsfromthe (xi);(xj)have(i;j;2f1;:::;ng).forinclusionovernon-emptysetsthis nitesetf(xi)ji2ighaveacommonlowerboundifeverytwoofitselements t1\:::\tnifallpairwiseintersectionsti\tjarenon-empty(i;j2f1:::ng), whichisrefutedbytheexamplei=f1;2;3gand(x1)=fa;bg,(x2)=fa;cg, (x3)=fb;cgfordistinctconstantsa;b;c. Proposition13.Thetreeprexorderingsatisesthecoherenceproperty. solutionof9z(vi2izxi). Proof.ForsomeniteindexsetJIandvariableassignmentintoPrex, pathconsistentsuchthattheunionsi2i(xi)ispathconsistent.henceisa isasolutionofall9z(zxi^zxj)thenallpairwiseunions(xi)[(xj)are notethatisasolutionof9z(vi2jzxi)isi2j(xi)ispathconsistent.if Acknowledgements.WewouldliketothankDavidBasin,DenysDuchier,Witold astheanonymousrefereesforvaluablecommentsondraftsofthispaper.theresearch Charatonik,HaraldGanzinger,GertSmolka,RalfTreinenandUweWaldmann,aswell 2 reportedinthispaperhasbeensupportedbythetheespritworkinggroupcclii (EP22457)andtheDeutscheForschungsgemeinschaftthroughtheGraduiertenkolleg KognitionswissenschaftandtheSFB378attheUniversitatdesSaarlandes. References 1.A.Aiken,D.Kozen,andE.Wimmers.DecidabilityofSystemsofSetConstraints withnegativeconstraints.informationandcomputation,1995. 11

2.A.AikenandE.Wimmers.SolvingSystemsofSetConstraints.InProc.7thLICS, pp.329{340.ieee,1992. 3.A.AikenandE.Wimmers.TypeInclusionConstraintsandTypeInference.In Proc.6thFPCA,pp.31{41.1993. 4.A.Aiken,E.Wimmers,andT.Lakshman.SoftTypingwithConditionalTypes. InProc.21stPOPL.ACM,1994. 5.L.Bachmair,H.Ganzinger,andU.Waldmann.SetConstraintsaretheMonadic Class.InProc.8thLICS,pp.75{83.IEEE,1993. 6.H.P.Barendregt.TheTypeFreeLambdaCalculus.InBarwise[7],1977. 7.J.Barwise,ed.HandbookofMathematicalLogic.Number90inStudiesinLogic. North{Holland,1977. 8.D.BasinandH.Ganzinger.AutomatedComplexityAnalysisBasedonOrdered Resolution.In11thLICS.IEEE,1996. 9.W.CharatonikandL.Pacholski.Negativesetconstraintswithequality.In Proc.9thLICS,pp.128{136.1994. 10.W.CharatonikandL.Pacholski.SetconstraintswithprojectionsareinNEXP- TIME.InProc.35thFOCS,pp.642{653.1994. 11.W.CharatonikandA.Podelski.TheIndependencePropertyofaClassofSet Constraints.InProc.2ndCP.LNCS1118,Springer,1996. 12.H.ComonandP.Lescanne.Equationalproblemsanddisunication.Journalof SymbolicComputation,7:371{425.1989. 13.R.Gilleron,S.Tison,andM.Tommasi.SolvingSystemsofSetConstraintswith NegatedSubsetRelationships.InProc.34ndFOCS,pp.372{380.1993. 14.N.Heintze.SetBasedAnalysisofMLPrograms.TechnicalReportCMU{CS{93{ 193,SchoolofComputerScience,CarnegieMellonUniversity.July1993. 15.N.HeintzeandJ.Jaar.ADecisionProcedureforaClassofSetConstraints (ExtendedAbstract).InProc.5thLICS,pp.42{51.IEEE,1990. 16.D.Kozen.Logicalaspectsofsetconstraints.InProc.CSL,pp.175{188.1993. 17.M.J.Maher.Logicsemanticsforaclassofcommitted-choiceprograms.InJ.-L. Lassez,ed.,Proc.4thICLP,pp.858{876.TheMITPress,1987. 18.M.J.Maher.CompleteAxiomatizationsoftheAlgebrasofFinite,Rationaland InniteTrees.InProc.3rdLICS,pp.348{457.IEEE,1988. 19.A.I.Malc'ev.AxiomatizableClassesofLocallyFreeAlgebrasofVariousType. InTheMetamathematicsofAlgebraicSystens:CollectedPapers1936-1967,ch.23, pp.262{281.north{holland,1971. 20.D.McAllester.AutomaticRecognitionofTractabilityinInferenceRelations. JournaloftheACM,40(2),Apr.1993. 21.D.McAllesterandR.Givan.TaxonomicSyntaxforFirst-OrderInference.Journal oftheacm,40(2),apr.1993. 22.D.McAllester,R.Givan,D.Kozen,andC.Witty.TarskianSetConstraints.In Proc.11thLICS.IEEE,1996. 23.M.Muller.TypeAnalysisforaHigher-OrderConcurrentConstraintLanguage. DoctoralDissertation.UniversitatdesSaarlandes,TechnischeFakultat,66041 Saarbrucken,Germany.Inpreparation. 24.J.Niehren.FunctionalComputationasConcurrentComputation.In23rdPOPL, pp.333{343.acm,1996. 25.J.NiehrenandM.Muller.ConstraintsforFreeinConcurrentComputation.In Proc.1stASIAN,LNCS1023,pp.171{186.Springer,1995. 26.TheOzProgrammingSystem.ProgrammingSystemsLab,UniversitatdesSaarlandes.Availableathttp://www.ps.uni-sb.de/www/oz/. 12

27.V.A.Saraswat.ConcurrentConstraintProgramming.TheMITPress,1993. 28.G.Smolka.TheOzProgrammingModel.InJ.vanLeeuwen,ed.,ComputerScienceToday,LNCS1000,pp.324{343.Springer,1995. AInes-ConstraintsforProgramAnalysis constraintprogramminglanguages[17,27]suchasoz[28](see[24,25]forformalfoundationsofoz).duringtheexecutionofprogramsintheselanguages, WeareinvestigatingtheapplicationofINESconstraintsforprogramanalysis. Morespecically,weintendtoconstructatypeanalysissystemforconcurrent thesetofpossiblevaluesisemptyforsomeprogramvariable. thepossiblevaluesofprogramvariablesareapproximatedbyconstraints.for analysisaddedincomments(usingthespecialfunctionsymbolproc).4 Forillustration,considerthefollowingOzprogramwithitsconstraint-based programswithoutsearch(backtracking),itisconsideredaprogrammingerrorif proc{px}x=aend proc{qy}y=bend {PZ}{QZ} %9x(p=proc(x)^x=a)^ %9y(q=proc(y)^y=b)^ argumentsxandy,respectively,aswellastwoprocedureapplicationswiththe TheprogramcontainsthedenitionoftwoproceduresPandQwithformal %proc(z)p^proc(z)q andz=bwillbeemittedwhichareinconsistentwitheachother. TheprogramvariablesP,Q,X,Y,andZaremappedtoconstraintvariablesp, sameactualargumentz.onexecutionoftheseapplications,theconstraintsz=a indicatedinthecomments.theconjunctionoftheseconstraintsischeckedfor q,x,y,andz,andtheprogramsubexpressionsaremappedtoconstraintsas AprogramanalysisintermsofINES-constraintscandetectthiserrorasfollows. satisabilityandtheprogramisrejectedifthistestfails.theaboveprogramis rejectedsinceitsanalysisimpliesza^zbwhichisunsatisable. useitexperimentallyforozprograms.thefulldescriptionofthetypeanalysis systemisoutofthescopeofthispaperandwillbereportedin[23]. WehaveimplementedatypeanalysissystembasedonINES-constraintsand constraintshavethethesametimecomplexityuptoalineartransformation. BOmittedProofs Proposition1.ThesatisabilityproblemsofINESconstraintsandofatINES 4Thisexamplealsoappearedinthefollow-uppaper[11]withtheexplicitstatement thatitisborrowedfromhere. 13

equivalenttoarst-orderformulaoverinesconstraints. Proof.WithrespecttothestructureP+(Tree),everyatINESconstraintis INESconstraints. Conversely,everyINESconstraintisequivalenttoarst-orderformulaoverat x=f(y)$xf(y)^f(y)x x6jy$9z(zx^zy): straintsintoatinesconstraintsandviceversa.hence,foreveryinesconstraint TheseequivalencescanbeinterpretedasconstrainttransformersfromINEScon- f(t)x$9y9z(tz^f(z)=y^yx) xf(t)$9y9z(xy^y=f(z)^zt) tt0$9x(tx^xt0) thereexistsasatisfactionequivalentconstraintandviceversa.itiseasytoorganizethetransformationssuchthattheypreservethesizeofconstraintsuptoa Prex. Lemma9.EveryA1-A2-closedandpathconsistentconstraintissatisableover factorof2.hence,thecomplexityofthesatisabilityproblemsispreserved.ut Proof.Let'beA1-A2-closedandpathconsistent.Wedeneavariableassignmentprex'intoPrexasfollows: Thepathconsistencyof'(condition1)impliesthepathconsistencyof p).wenowverifythatprex'isasolutionof'. prex'(x).thusprex'(x)isatreeprex(onecanshowthisbyinductionover prex'(x)=f(p;f)jx';pfg {Considerx=f(y1:::yn)in'.Ifi2f1:::ngandyi';pgthenx';ipg. {Letxyin'.Ify';pgthenx';pgbythedenitionofpathreachability. Thus,prex'(y)prex'(x). Thus,f(prex'(y1):::prex'(yn))prex'(x).Fortheconverseinclusion, werstshowthat'satisesthefollowingtwopropertiesforallgandi: ForprovingP1weassumex';"g.Sincex=f(u)in'wehavexxin'by P2 P1 ifi2f1:::ngandx';ipgthenyi';pg. ifx';"gthenf=g. A1:1-closedness.Thusx';"fwhichimpliesf=gsince'ispathconsistent (condition1)anda1:1-closed,i.e.p1holds. ForprovingP2,weassumei2f1:::ngandx';ipg.Bydenitionofpath reachabilitythereexistsx0,f0,andvsuchthat x';"x0; x0=f0(y01:::y0i:::y0n); 14 y0i';pg:

TheA1:2-closednessof'andx';"x0implyxx0in'.Thepathconsistency Wenallyshowprex'(x)f(prex'(y1):::prex'(yn)).Given(p;g)2 closednessensuresyiy0iin'suchthatyi';pgholds.thisprovesp2. of'(condition1)andthea1:1-closednessof'impliesf=f0.hence,a2- {Letx6jyin'.Wehavetoshowthatthesetprex'(x)[prex'(y)ispath f=gandhence(";g)2f(prex'(y1):::prex'(yn)).ifp=iqthenx';iqg prex'(x),wedistinguishtwocases.ifp=",thenx';"gsuchthatp1implies suchthatp2yieldsyi';qgandhence(p;g)2f(prex'(y1):::prex'(yn)). Lemma10.EveryA3-A5-closedconstraintispathconsistent. consistent.if(p;g)2prex'(x)and(p;f)2prex'(y)thenx';pgand y';pf.thepathconsistencyof'(condition2)impliesf=g. 2 2ofDenition8andA3:1-closedness.Theproofofcondition2inDenition8is Proof.Let'beA3?A5-closed.Condition1ofDenition8followsfromcondition byinductiononpathsp.weassumex,y,f,andgsuchthatx';pf,x6jyin', andx';pg. Ifp=",thenthereexistn;m0,x1;:::;xn,y1;:::ym,u,andvsuchthat: A3-closednessimpliesthatxn6jymin'(A3:2yieldsx6jy1in',:::,x6jymin'. Thusym6jxin'byA3:3-closednesssuchthatA3:2-closednessyields yy1^:::^ym?1ym^ym=g(y0)in': xx1^:::^xn?1xn^xn=f(x0)in'; ym6jx1in',:::,ym6jxnin').hence,a4-closednessimpliesf=g.ifp=iq, thenthereexistf0,g0,x0,y0,u,vwith: Sincex6jx0in',wehavex06jy0in'byA3-closedness(thishasbeenprovedfor y';"y0;y0=g0(y01:::y0i:::y0n)in';y0i';pg: x';"x0;x0=f0(x01:::x0i:::x0n)in';x0i';pf; thecasep=").thus,a4-closednessyieldsf0=g0suchthata5-closedness impliesx0i6jy0iin',andhencef=gholdsbyinductionassumption. CComplexity 2 WeelaboratetheproofofthecomplexityandincrementalitystatementinTheorem5bypresentinganimplementationofalgorithmA. itterminatesintimeo(n3)wherenisthesizeoftheinputconstraint. Proposition14.AlgorithmAcanbeimplemented(onlineandoine)suchthat 15

oremptymultisetsrepresentedby>.initially,thepool'istheinputconstraint called'0(whichmaybeinputedincrementallyintheonlinecase)andthestore where'iscalledpooland Proof.WeorganizealgorithmAasareductionrelationonpairs('; isempty. store.thestoreandthepoolareeitherconstraints )or?, of apair('; Reductionpreservestheinvariantthat'^ ('0; withrespecttoalgorithma(andrestrictedtovariablesoccuringin'0).if )reducesto?then'^ isequivalentto?.if('; containsallone-stepconsequences nalstoreisa-closedandequivalenttotheinitialconstraint'0. orwithanemptypool.inthelattercase,theaboveinvariantsensurethatthe 0)then'^ isequivalentto'0^ 0.Reductioneitherterminateswith? )reducesto implementedbyrecursivelyexecutingthefollowingsequenceofinstructions: Letabasicconstraintbeoftheformxy,x6jy,orx=f(y).Reductioncanbe 1.Selectabasicconstraint'0fromthepool.If'0iscontainedinthestore 2.Else,forallaxiomsinAoftheform'0^ deleteiffromthepoolandnish. '00tothepool.Ifthereexistsanaxiomoftheform'0^ 0!'00with 0inthepooladd 3.Add'0tothestoreanddeleteitfromthepool. isnotcontainedinthestorethenaddittothestore. 0inthepoolthenreduceto?.If'0containsavariablexsuchthatxx 0!?inAwith arestrictedcase.inasecondstepweshowthattheserestrictionscanbeomitted. Werstdiscussthenecessarydatastructuresforimplementingthereductionin R3'0containsatmostoneequalitypervariable. R2Thearityofconstructorsin'0isboundedbyaconstant,sayk. R1Thealgorithmisoine,i.e.theinputconstraint'0isstaticallyknown. Letmbethenumberofvariablesin'0.Thepoolcanbeimplementedsuchthat itprovidesforthefollowingoperations(forinstanceasaqueue). {selectanddeleteabasicconstraintfromthepoolino(1). mostonepervariable)andatableofsize2m2fortheconstraintsxyandx6jy Thestorecanbeimplementedasanarrayofsizemfortheequalitiesx=f(y)(at foralloccuringvariables.thestorecansupportthethefollowingoperations: {addabasicconstrainttothepoolino(1). {testthepresenceofanequalityforxino(1). {givenavariablexwithx=f(y)2',retrievethefunctionsymbolfandthe {testthemembershipxy2 sequenceyintimeo(1). andx6jy2 intimeo(1). 16

{givenavariablex,retrievethesetofallysuchthatxy2'intimeo(m) {addabasicconstraintintimeo(1). Asshowninthenextparagraph,thereductionrelationcanbeimplementedsuch thatalloperationsonthestoreandthepoolareinvokedadmosto(m2)times. (analogouslyforx6jy). SinceeveryoperationcostsatmostO(m)timeandmn,thisyieldsanO(n3) ThereareatmostO(m2)distinctbasicconstraintsthatmaybeaddedtothe implementation. storeandeverybasicconstraintmaybeaddedatmostonce.hencethereareat mosto(m2)addoperationsonthestore.constraintsareaddedtothepoolonly ifsomebasicconstraintisaddedtothestore.inthiscase,atmosto(k)basic constraintsareaddedtothepoolbyr2.hence,thereareatmosto(km2)add operationsonthepool. Wenallydiscusshowtogetridoftheaboverestrictions. R2IfthearityofconstructorsisunboundedthenwestillknowthateveryoperationcostatmostO(n)wherenisthesizeof'0.Theonlyproblemis thatthenumberofbasicconstraintsthatmaybeaddedtothepoolisno tothepoolatmostonce,i.e.byrememberingthoseconstraintsthathave beenaddedtopool(andpossiblydeleted)before.thiscanbedonewitha quadratictableasforthestore. moreboundedbyo(n2).thiscanbecircumventedbyaddingconstraints R1Foranonlinealgorithm,wecanaddtheinputconstraint'0incrementally R3Ifwereplaceallequalitiesx=f(y)in'0byxx0^x0x^x0=f(y)wherex0 isafreshvariablerespectivelythentheresultingconstraintdoesnotcontain twoequationsforthesamevariable. tothepool.theproblemisthatthenumberofvariablesin'0isnotknown statically.wehavetoreplaceourstatictablesandarraysbydynamichash DFiniteTrees tablessuchthatnewvariablescanbeinserted. 2 niteorinnitetrees. Example6.Forinstance,theconstraintxf(x)issatisableoversetsofinnite ThesatisabilityofINESconstraintsdependsontheinterpretationoversetsof treesbyx7!ff(f(f(:::)))g,butnon-satisableoversetsofnitetrees. TheresultsofSectionCcarryovertothenitetreecasewhenweaddthe \occurs-check"axioma6fromtable2toaxiomseta.inparticular,lemma9 andtheorem5canbeadapted.calltreenthesetofnitetrees. 17

A6.'!?ifx';pxforsomepathp6=" Lemma15.Apathconsistentconstraint'closedunderA1-A3andA6issatisableinP+(Treen). Table2.Theoccurscheckaxiom ableinp+(tree)wehavedenedtheprexprex'(x)=f(p;f)jx';pfg.since Proof.ToshowaA1-A3andA6-closedandpathconsistentconstraint'satis- mustbeaniteprexforallx.hence,'issatisableinp+(treen). 'isniteandtheassumptionaboutaxioma6excludescyclicpaths,prex'(x) Theorem16.ThesatisabilityofINESconstraintsovernon-emptysetsofnite treescanbedecided(oineoronline)intimeo(n3). 2 everystep.thisisconstantiftheclosureofthereachabilityrelationbetween variablesis(justlike)implementedbyatableofsizequadraticinthenumber termination.thisislinearinthesizeofthenalconstraintandcubicinthesize ofthestartconstraint.theonlineversionmustscheduletheoccurs-checkafter Proof.Theoineversionofouralgorithmmayperformtheoccurs-checkupon EStandardSetConstraints ofvariables. 2 emptinessconstraintsx6;(\xdenotesanon-emptyset").weshowthatthe cubicalgorithmforinesconstraintscanbeadaptedtothisfragmentofstandard INESconstraintsoverpossiblyemptysetsoftreesandallowingforexplicitnon- Inthissection,wetakeaalternativeapproachtoachievetheexpressivenessof setconstraintsatthecostofadditionalaxioms. INESconstraints.Weconsideraclassofstandardsetconstraintsbyinterpreting WeinterpretetheseconstrainteitherinthestructureofsetsoftreesP(Tree) lows. Weextendourconstraintsyntaxwithexplicitnon-emptinessconstraintsasfol- satisabilityofsetconstraintsdiersdependingonthechoiceofniteorinnite orinthestructureofsetsofnitetreesp(treen).duetotheconstraintx6;, '::='1^'2jx=f(y)jxyjx6jyjx6; (1) trees.thisisnotthecasewithoutx6;aswewillshowbelow(corollary20). Example6adaptsasfollows. Example7.Theconstraintx6;^xf(x)issatisableoversetsofinnitetrees bythevariableassignmentx7!ff(f(f(:::)))g,butnon-satisableoversetsof nitetrees. 18

A1.xxandxy^yz!xz A3'.x6;^xy!x6jyandxy^x6jz!y6jzandx6jy!y6jx A4.f(y)x^x6jx0^x0g(z)!?forf6=g A2'.x6;^x=f(y)^xx0^x0=f(z)!yz A6'.x6;^'!?ifx';pxforsomepathp6=" A5.x=f(y)^x6jx0^x0=f(z)!y6jz B8.x6jy!y6; B7.x6;^x=f(y)!y6;andy6;^x=f(y)!x6; InTable3,wepresentthesetofaxiomsB,whichadaptsthesetAforthenew Table3.Axiomsforinclusionconstraintsover(possiblyempty)setsofnitetrees emptinesspremisesexplicit,andb7andb8havebeenadded.b7propagatesnon- emptinessthroughterms.foreveryconstantsymbola2,b7:2postulatesthat musthaveanon-emptydenotationthemselves.itiseasilycheckedthatallthese constraints.theaxiomsetsa20,a30,anda60arechangedtomakeimplicitnon- P(Tree). axiomsarevalidinp(treen)andthatallaxiomsapartfroma6arevalidin x=a!x6;.b8statesthatvariablesinvolvedinanon-disjointnessconstraint Proposition17.EveryB-closedconstraintissatisableoverP(Treen).Every constraintthatisb-closedapartfromtheoccurs-checkaxioma6'issatisable overp(tree). Proof.GivenaB-closedconstraint',wedenethesetofvariablesin'which areconstrainedtobenon-empty. Thepart of'containingonlyvariablesvar' 6;def =fxjx6;in'g Forthenitetreecase,assume'tobeB-closed.ByProposition15thereexists straintsisaclosedinesconstraint. avariableassignmentintop+(treen)whichsatises 6;andnonon-emptinesscon- Denethevariableassignmentby(x)=;forx62Var' elsewhere.weshowthatsatises'.letx62var' in'containingx. 6;.Weconsidertheinclusions inp(treen). 6;and(x)=(x) 19

{Ify=f(:::x:::)in',theny6;cannotbein'duetoB7:2.Hence(y)= {Constraintsxyaretriviallysatisedby. {Ifx=f(y1:::yn)in',thenyi6;cannotbein'forsomeyiduetoB7:1. {Ifyxin',theny6;cannotbein'duetoA30andB8.Hence(y)= ;(f(:::x:::)). ;(x). Hence(x)=;=(f(:::yi:::)). Fortheinnitetreecaseassume'tobeB-closedwiththeexceptionofA6'.Then bylemma9,thereexistsasatisfyingvariableassignmentintop+(tree).apart fromthat,theaboveargumentisunchanged. Theorem18.Thesatisabilityofconjunctionsofinclusionconstraintsand non-emptinessconstraintsoversetsofnitetreescanbetestedino(n3). 2 AtomicSetConstraints.INESconstraintsinterpretedoverallsetsofnite Proof.TheaxiomsinTable3againinduceaxedpointalgorithmforthesatisabilitytest.Bycarryingoverthetechniquesforthecomplexityresultsfrom treesp(treen)arealsocalledatomicsetconstraints[15].theorem18implies SectionC,weobtainthesamecomplexitybound. timecomplexityo(n3)fortheirsatisabilityproblem.furthermore,weshow 2 thattheoccurscheckaxioma60isnotneededtodecidesatisabilityofatomic setconstraints. Proof.Ifx';pxforsomep6=",thenalsox';pnxforeverypathpn=pp:::p (n-foldconcatenation).thus,foreveryprexqofsuchapathpn,thereexistsa doesnotimply?accordingtoaxioma60. Lemma19.Lettheconstraint'beB-closedwiththeexceptionofA60.Then' Butthenthereexistn1andaprexqofpnleadingtoaleafint.Thus, non-constantfunctionsymbolf2andatermf(y)suchthatx';qf(y). (q;a)2tforsomeconstantsymbola2.ifx';qf(y),wecanshowby Ifx6;2'then'containsaconjunctionexpressingthattxforsome groundtermt. (2) inductionoverqthatthereexistz;z0suchthatz=a,zz0,andz0=f(y)in'. FromLemma19andTheorem18wehavethefollowingCorollary[.Notethat thisisincontrasttoexamples6and7. whichcontradictstheassumption. FromB7:2,andA30weobtainz6jz0andhence,?isaconsequenceofAxiomA4 2 Corollary20.Thesatisabilityofatomicsetconstraintsisinvariantwithrespecttotheinterpretationoversetsofniteorinnitetrees. 20