UnderconsiderationforpublicationinTheoryandPracticeofLogicProgramming1EnhancedSharingAnalysisTechniques:AComprehensiveEvaluationROBERTOBAGNARADepartmentofMathematics,UniversityofParma,Italy(e-mail:bagnara@cs.unipr.it)ENEAZAFFANELLADepartmentofMathematics,UniversityofParma,Italy(e-mail:zaffanella@cs.unipr.it)PATRICIAM.HILLySchoolofComputing,UniversityofLeeds,Leeds,U.K.(e-mail:hill@comp.leeds.ac.uk)AbstractSharing,anabstractdomaindevelopedbyD.JacobsandA.Langenfortheanalysisoflogicprograms,derivesusefulaliasinginformation.Itiswell-knownthatacommonlyusedcoreoftechniques,suchastheintegrationofSharingwithfreenessandlinearityinformation,cansignicantlyimprovetheprecisionoftheanalysis.However,anumberofotherproposalsforreneddomaincombinationshavebeencirculatingforyears.Onefeaturethatiscommontotheseproposalsisthattheydonotseemtohaveundergoneathoroughexperimentalevaluationevenwithrespecttotheexpectedprecisiongains.Inthispaperweexperimentallyevaluate:helpingSharingwiththedenitelygroundvariablesfoundusingPos,thedomainofpositiveBooleanformulas;theincorporationofexplicitstructuralinformation;afullimplementationofthereducedproductofSharingandPos;theissueofreorderingthebindingsinthecomputationoftheabstractmgu;anoriginalproposalfortheadditionofanewmoderecordingthesetofvariablesthataredeemedtobegroundorfree;arenedwayofusinglinearitytoimprovetheanalysis;therecoveryofhiddeninformationinthecombinationofSharingwithfreenessinformation.Finally,wediscusstheissueofwhethertrackingcompoundnessallowsthecomputationofmoresharinginformation.1IntroductionIntheexecutionofalogicprogram,twovariablesarealiasedorshareatsomepro-grampointiftheyareboundtotermsthathaveacommonvariable.Conversely,twovariablesareindependentiftheyareboundtotermsthathavenovariablesincommon.Thatis,ifitisnotpossiblefortwovariablestosharethentheyareTheworkoftherstandsecondauthorshasbeenpartlysupportedbyMURSTproject\Cer-ticazioneautomaticadiprogrammimedianteinterpretazioneastratta.yThisworkwaspartlysupportedbyEPSRCundergrantGR/M05645.2R.Bagnara,E.ZaanellaandP.M.Hilldenitelyindependentandviceversa.Inlogicprogramming,aknowledgeofthepos-siblealiasing(or,equivalently,deniteindependence)betweenvariableshassomeimportantapplications.InformationaboutvariablealiasingisessentialfortheecientexploitationofAND-parallelism(Chang,DespainandDeGroot1985,HermenegildoandGreene1990,JacobsandLangen1992,MuthukumarandHermenegildo1992).Informally,twoatomsinagoalareexecutedinparallelif,byamixtureofcompile-timeandrun-timechecks,itcanbeguaranteedthattheydonotshareanyvariable.Thisimpliestheabsenceofbindingconictsatrun-time:itwillneverhappenthattheprocessesassociatedtothetwoatomstrytobindthesamevariable.Anothersignicantapplicationisoccurs-checkreduction(Crnogorac,KellyandSndergaard1996,Sndergaard1986).Itiswell-knownthatmanyimplementedlogicprogramminglanguages(e.g.,almostallPrologsystems)omittheoccurs-checkfromtheunicationprocedure.Occurs-checkreductionamountstoidentifyingtheunicationswheresuchanomissionissafe,and,forthispurpose,informationonthepossiblealiasingofprogramvariablesiscrucial.Aliasinginformationcanalsobeusedindirectlyinthecomputationofotherinterestingprogramproperties.Forinstance,theprecisionwithwhichfreenessin-formationcanbecomputeddepends,inacriticalway,ontheprecisionwithwhichaliasingcanbetracked(Bruynooghe,CodishandMulkers1994a,Codish,Dams,FileandBruynooghe1993,File1994,KingandSoper1994,Langen1990,Muthuku-marandHermenegildo1991).Inadditiontothesewell-knownapplications,arecentlineofresearchhasshownthataliasinginformationcanbeexploitedinInductiveLogicProgramming(ILP).Inparticular,in(Blockeel,Demoen,Janssens,VandencasteeleandLaer2000),theauthorsconsiderseveraloptimizationsproposedforspeedinguptherenementofinductivelydenedpredicatesinILPsystems.Theapplicabilityoftheseopti-mizations,previouslydenedintermsofsyntacticconditionsontheconsideredpredicate,canberecastastestsonvariablealiasing.Therefore,byusingtheresultsoftheanalysistoguidetheoptimizationphase,correctnessresultsaresimplyin-heritedand,thankstothegaininprecision,therearemoreopportunitiestoapplytheproposedoptimizations.Beforecontinuing,abriefnoteonterminology:avariableiscompoundifitisboundtoanon-variableterm,itisgroundifitisboundtoatermcontainingnovariables,itisfreeifitisnotcompound,itislinearifitisboundtoatermthatdoesnotcontainmultipleoccurrencesofavariable.Sharing,adomainduetoD.JacobsandA.Langen(JacobsandLangen1989,JacobsandLangen1992,Langen1990),isbasedontheconceptofset-sharing.AnelementoftheSharingdomain,whichisasetofsharing-groups(i.e.,asetofsetsofvariables),representsinformationongroundness,groundnessdependencies,possiblealiasing,andmorecomplexsharing-dependenciesamongthevariablesthatareinvolvedintheexecutionofalogicprogram(Bagnara,HillandZaanella1997).EventhoughSharingis,inasense,remarkablyprecise,itiswell-knownthatmoreprecisionisattainablebycombiningitwithotherdomains.AsarguedinformallybyH.Sndergaard(Sndergaard1986),linearityinformationcanbesuitablyexploitedEnhancedSharingAnalysisTechniques:AComprehensiveEv