# n3 - Axiomatic Semantics(of IMP the imperative language...

This preview shows pages 1–7. Sign up to view the full content.

Axiomatic Semantics (of IMP, the imperative language whose translational semantics we de- ﬁned) References: Kurtz (Ch. 11); Pagan (Ch. 4.3) Summary: For each statement of IMP, we will de- ﬁne its (axiomatic) semantics by giving an ax- iom or rule (of inference). Using these axioms and rules, we will be able to show (i.e., derive) that a given program behaves according to a given speciﬁcation. 33

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Preliminaries State : The state σ of a program P is a function that maps the program variables (of P) to their values in that state: Example: h x = 1 , y = 2 , z = 3 i , or σ ( x ) = 1 , σ ( y ) = 2 , σ ( z ) = 3 (assuming P has 3 program variables x,y,z ). Usually we have to deal with a set of states: {h x = 1 , y = 2 , z = 1 i , h x = 1 , y = 2 , z = 2 i , h x = 1 , y = 2 , z = 3 i} . 34
A better way to specify a set of states is to specify an assertion (or predicate , or condition ) that is satisﬁed by all the states in the set ( and no others ): [ x = 1 y = 2 1 z 3 ] Assertion Set of states that satisfy the assertion. Examples: [ x = 1 1 y 5 1 z 10 ]: set with 50 elements. [ x = 1 y = 2 ]: an inﬁnite set. [ x = 1 1 y 5 ]: an ‘even bigger’ set. 35

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
[ x = y + z ]: . . . [ x = x ]: The set of all states. true [ x 6 = x ]: The empty set. false Convention : p P ( p is an assertion, P the corresponding set of states.) [ p q ] P Q [ p q ] P Q [ ¬ p ] P (i.e., U - P ) 36
We can think of as a relation between two assertions: ( p q ) ( P Q ) ( p true ) ( P U ) ( false p ) P ) We can also think of as giving us a single assertion: ( p q ) ( ¬ p q ) Thus: ( p true ) true ( false p ) true ( p p ) true (??) ( p ⇒ ¬ p ) false (??) ( x 1 x = 2) ?? 37

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
skip , as- signment, sequential composition, if-then-else, while, read and write commands. Only integer variables; no procedures or functions; variables are declared implicitly. The Assertion Language: Boolean expressions of IMP, plus quantiﬁers. Note: x < y is a syntactic entity when it ap- pears in a program. Elsewhere it is an assertion that is satiﬁed by some states and not others. The context will tell which is meant. A state σ satisﬁes the assertion x < y if (and only if) σ ( x ) is less than σ ( y ). Notation:
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/10/2008 for the course CSE 755 taught by Professor Neelamsoundarajan during the Winter '05 term at Ohio State.

### Page1 / 24

n3 - Axiomatic Semantics(of IMP the imperative language...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online