Precise and expressive mode systems for typed logi

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

PreciseandExpressiveModeSystemsforTypedLogicProgrammingLanguagesDavidOvertonSubmittedintotalfulfilmentoftherequirementsofthedegreeofDoctorofPhilosophyDecember2003DepartmentofComputerScienceandSoftwareEngineeringTheUniversityofMelbourneVictoria3010,AustraliaAbstractInthisthesiswelookatmodeanalysisoflogicprograms.Beingbasedonthemathematicalformalismofpredicatelogic,logicprogramshavenoapriorinotionofdataflow—asinglelogicprogrammayruninmultiplemodeswhereeachmodedescribes,orprescribes,apatternofdataflow.Amodesystemprovidesanabstractdomainfordescribingtheflowofdatainlogicprograms,andanalgorithmforanalysingprogramstoinferthemodesofaprogramortocheckthecorrect-nessofmodedeclarationsgivenbytheprogrammer.Suchananalysiscanprovidemuchusefulinformationtothecompilerforoptimisingtheprogram.Inaprescriptivemodesystem,modeanalysisisalsoanimportantpartofthesemanticanalysisphaseofcompilation(muchliketypeanalysis)andcaninformtheprogrammerofmanyerrorsorpotentialerrorsintheprogramatcompiletime.Wethereforebelieveitisanessentialcomponentofanyindustrialstrengthlogicprogrammingsystem.Ouraimistodevelopastrongandprescriptivemodesystemthatisbothaspreciseandexpressiveaspossible.WebelievethisrequiresastronglytypedandpurelydeclarativelanguageandsowefocusonthelanguageMercury.ThefirstcontributionofourworkistogiveadetaileddescriptionofMercury’sexistingmodesystem,whichisbasedonabstractinterpretation.Althoughmostofthissystemhasbeenaroundforseveralyears,thisisthefirsttimeithasbeendescribedinthislevelofdetail.Thisisalsothefirsttimetherelationshipofthemodesystemtotheformalismofabstractinterpretationhasbeenmadeclear.Followingthat,welookatwaysofextendingthemodesystemtoprovidefurtherprecisionandexpressiveness,andtoovercomesomeofthelimitationsofthecurrentsystem.Thefirstoftheseextensionsistosupportaformofconstrainedparametricpolymorphismformodes.Thisisanalogoustoconstrainedparametricpolymorphictypesystemssuchastypeclasses,andaddsasomewhatsimilardegreeofexpressivenesstothemodesystem.Nextwelookatamethodforincreasingtheprecisionofthemodeanalysisbykeepingtrackofaliasesbetweenvariables.Theincreasedprecisionwegainfromthisallowsanincreaseinexpressivenessbyallowingtheuseofpartiallyinstantiateddatastructuresandmorecomplexuniquenessannotationsonmodes.ThefinalareawelookatisanalternativeapproachtomodeanalysisusingBooleanconstraints.Thisallowsustodesignamodesystemthatcancapturecomplexmodeconstraintsbetweenvariablesandmoreclearlyseparatesthevarioustasksrequiredformodeanalysis.Webelievethatthisconstraint-basedsystemprovidesagoodplatformforfurtherextensionoftheMercurymodeiiiAbstractsystem.TheworkwedescribehasallbeenimplementedintheMelbourneMercurycompiler,althoughonlyconstrainedparametricpolymorphismhassofarbecomepartofanofficialcompilerrelease.DeclarationThisistocertifythat(i)thethesiscomprisesonlymyoriginalworktowardsthePhDexceptwhereindicatedinthePreface,(ii)dueacknowledgementhasbeenmadeinthetexttoallothermaterialused,(iii)thethesisislessthan100,000wordsinlength,exclusiveoftables,maps,bibliographiesandappendices.DavidOvertonDecember2003iiiivDeclarationPrefaceThisthesiscomprises7chapters,includinganintroductionandconclusion.Followingtheintro-duction,Chapter2providesthebackgroundandnotationnecessarytounderstandtherestofthethesis.Chapter3presentsthemodeanalysissystemasitiscurrentlyimplementedintheMelbourneMercurycompiler.Chapter4presentsextensionstothemodesystemtoallowmodepolymorphism.Chapter5describesanextensiontothemodesystemtokeeptrackofdefinitealiases.Chapter6presentsanewapproachtomodeanalysisusingBooleanconstraints.Finally,Chapter7containssomeconcludingremarks.ThemodesystemdescribedinChapter3wasdesignedandimplementedbyFergusHendersonandothers,howeverthenotationfortheformalisationofthesystemwhichispresentedinthisthesisisentirelymyownwork.Section5.3isbasedonresearchpartofwhichwascarriedoutjointlywithAndrewBromage.Ithasnotpreviouslybeenpublished.Section5.4isbasedonpartofRoss,Overton,andSomogyi[117].Chapter6isbasedonOverton,Somogyi,andStuckey[111],howevermostofthematerialdescribingtheimplementationisnew.vviPrefaceAcknowledgementsThisresearchhasbeenmadepossiblebythefinancialsupportoftheCommonwealthofAustraliaintheformofanAustralianPostgraduateAward.Iwouldliketothankmysupervisor,ZoltanSomogyi,andtheothermembersofmyadvisorycommittee,LeeNaishandHaraldSøndergaard,fortheiradviceandsupportthroughoutmyPhDcandidature.ThankyoualsotoAndrewBromage,PeterRossandPeterStuckeywithwhomIhavecollaboratedonvariouscomponentsoftheresearchpresentedhere.ThankyoutoPeterSchachteforprovidingtheROBDDpackagewhichIusedforimplementingtheworkofChapter6.ThankyoutomyverygoodfriendTomConway,withoutwhoseencouragementIneverwouldhavegotinvolvedintheMercuryprojectorstartedaPhD(don’tworry,Tom,I’veforgivenyou).ThankyoutoFergusHendersonwhoseextremelythoroughcodereviewshelpedgreatlytoimproveboththisresearchanditsimplementation.TotherestoftheMercuryteam,RalphBecket,MarkBrown,SimonTaylor,DavidJefferyandTysonDowd,ithasbeengreatworkingwithallofyou.Ihavelearntagreatdealaboutlogicprogramming,languagedesignandsoftwareengineeringinm

1 / 197
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功