This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 395 Chapter 11 AXIOMATIC SEMANTICS T he techniques f o r ope r ational semantics, int r oduced in Chapte r s 5 th r ough 8, and denotational semantics, discussed in Chapte r s 9 and 10, a r e based on the notion o f the state o f a machine . Fo r example, in the denotational semantics o f W r en, the semantic equation f o r the execution o f a statement is a mapping f r om the cu rr ent machine state, r ep r esented by the sto r e, input st r eam and output st r eam, to a new machine state. Based on methods o f logical deduction f r om p r edicate logic, axiomatic se- mantics is mo r e abst r act than denotational semantics in that the r e is no concept co rr esponding to the state o f the machine. R athe r , the semantic meaning o f a p r og r am is based on asse r tions about r elationships that r e- main the same each time the p r og r am executes. T he r elation between an initial asse r tion and a final asse r tion f ollowing a piece o f code captu r es the essence o f the semantics o f the code. A nothe r piece o f code that defines the algo r ithm slightly di ff e r ently yet p r oduces the same final asse r tion will be semantically equivalent p r ovided any initial asse r tions a r e also the same. T he p r oo f s that the asse r tions a r e t r ue do not r ely on any pa r ticula r a r chitec- tu r e f o r the unde r lying machine ; r athe r they depend on the r elationships between the values o f the va r iables. A lthough individual values o f va r iables change as a p r og r am executes, ce r tain r elationships among them r emain the same. T hese inva r iant r elationships f o r m the asse r tions that exp r ess the semantics o f the p r og r am. 11.1 CONCEPTS AND EXAMPLES A xiomatic semantics has two sta r ting points : a pape r by R obe r t Floyd and a somewhat di ff e r ent app r oach int r oduced by C. A . R . Hoa r e. W e use the nota- tion p r esented by Hoa r e. A xiomatic semantics is commonly associated with p r oving a p r og r am to be co rr ect using a pu r ely static analysis o f the text o f the p r og r am. T his static app r oach is in clea r cont r ast to the dynamic ap- p r oach, which tests a p r og r am by f ocusing on how the values o f va r iables change as a p r og r am executes. A nothe r application o f axiomatic semantics is to conside r asse r tions as p r og r am specifications f r om which the p r og r am code itsel f can be de r ived. W e look at this technique b r iefly in section 11.5. 396 CHAPTER 11 AXIOMATIC SEMANTICS A xiomatic semantics does have some limitations : Side e ff ects a r e disallowed in exp r essions ; the g o t o command is di f ficult to speci f y ; aliasing is not al- lowed ; and scope r ules a r e di f ficult to desc r ibe unless we r equi r e all identifie r names to be unique. Despite these limitations, axiomatic semantics is an att r active technique because o f its potential e ff ect on so f twa r e development : T he development o f bug f r ee algo r ithms that have been p...
View Full Document
This note was uploaded on 02/01/2012 for the course COP 4020 taught by Professor Engelen during the Spring '11 term at FSU.
- Spring '11