F. Model checking software at compile time(5)

流年开花 分享 2021-06-02 下载文档

De nitionAlabeledgraph(L,E,µL)overthealphabetΣLisa niteanddirectedgraph,whereLisasetofnodes,E L×Lisanedgerelationbetweenthenodes,andµL:L→ΣLisanodelabelingfunction.

AlabeledtreeisalabeledgraphT=(L,E,µL)ifithasasinglerootnoderoot(T)forwhichwehavethefollowing:Foreachnodel∈Lthereexistsexactlyonepathfromtheroottothenode,i.e.exactlyonesequencel0,...,ln,suchthatl0=root(T),ln=l,and(li 1,li)∈E,fori=1,...,n.

Anattributedtree(L,E,µL,µE)overthealphabetsΣLandΣEisalabeledtreewherethereisanadditionallabel-ingfunctionµA:L→ΣA,assigningattributestonodes.Giventwonodesl1andl2ofalabeledtree(L,E,µL),wecalll1theparentofl2andl2thechildif(l1,l2)∈E.Ifthereexistsa(non-empty)pathfroml1tol2,l1iscalledancestorofl2,andl2isadescendantofl1.

AnASTcanbeseenasanattributedtreewherethenodesarelabeledwithprogramstatementsand(sub)expressionswhiletheattributesdescribetheroleofanode’sbranch.E.g.,theconstructinFigure3(a)showspartofanASTforanif-thenbranching.Theattributesdescribewhetherthesubtreeistheif-branch,thecondition,orthenextinstruc-tionofitsparentnode.Thelabelsthendescribethekindofstatementorexpressionoftheconditionorthestatementfollowingtheif-then.

FromtheASTwecanconstructinastraightforwardmannerthecontrol owgraph(CFG).NotethataCFGdoestypicallynotcontainalltheinformationavailableintheAST,onlythecontrolstructuredowntothelevelofstatements,butnotthestructureofexpressions,types,andconstantvalues.

ACFGisagraph,terweaddlabelsmakingitalabeledgraph.WedenotethelabeledCFGofanASTTbyCFGT.Thelabelsrep-resentwhethercertainatomicpropositionsholdinanode.E.g.,ifaparticularvariableisassignedavalue,ifitisusedontheright-handsideofanassignment,orifitisderefer-encedandsoon.

Inourframework,theselabelsareassociatedwithtreepatternsontheAST.Wede nethesyntaxofaquerylan-guagetomatchtreepatternsasfollows:

P::= | |σE|σL|↓|↓ |P/P|P∪P|P[Q]Q::=P|label=σL|attr=σA|Q∧Q|Q∨Q3

3.1

TemporalLogicPropertiesoverPro-grams.

Undertheassumptionthatwecanidentifyatomicpropo-sitionsdeclx,usedxandassignedx,representingprogramlocationswhereavariablexisdeclared,used,orassignedavaluerespectively,wecanspecifythatthisvariableisal-waysinitializedbeforeitisusedasfollowsinCTL:

AGdeclx (A¬usedxWassignedx)

(1)

Thismeanswerequirethatonallprogrampathsifavari-ablexisdeclareditmustnotbeuseduntilithasavalueassignedoritwillnotbeusedatall.Weusetheweakun-tiloperatorWheretoincludethesecondpossibility.Thelattercanalsopointtounusedvariables,whichischeckedseparately.

Inthesamestylewecanexpressotherpropertiesoncor-rectpointerhandling,variableusageormemoryallocationanddeallocation.Moreover,itallowsspecifyingapplicationspeci cpropertiestohandlegeneralprogrammingguide-lines,API-speci crulesorevenhardware/softwareinter-facerulesfordrivers.

Intheremainderofthissectionwedescribehowtomapprogramstotransitionsystemslabeledwithatomicpropo-sitionssuchastheonesaboveandhowtoderivethelabelsthemselvesfromaprogram.


F. Model checking software at compile time(5).doc 将本文的Word文档下载到电脑

下一篇:全国2010年1月高等教育自学考试领导科学试题V

相关推荐
相关阅读
本类排行
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 7

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xxxxxx QQ:xxxxxx