# L189WP - Axiomatic Semantics Predicate Transformers...

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

cs784(Prasad) L189wp 1 Axiomatic Semantics Predicate Transformer s

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

View Full Document
cs784(Prasad) L189wp 2 Motivation Problem Specification Properties satisfied by the input and expected of the output (usually described using “assertions”). E.g., Sorting problem Input : Sequence of numbers Output : Permutation of input that is ordered. Program Transform input to output . Input Output
cs784(Prasad) L189wp 3 Sorting algorithms » Bubble sort; Shell sort; » Insertion sort; Selection sort; » Merge sort; Quick sort; » Heap sort; Axiomatic Semantics To show that a program satisfies its specification, it is convenient to have the description of the language constructs in terms of assertions characterizing the input and the corresponding output states.

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

View Full Document
cs784(Prasad) L189wp 4 Axiomatic Approaches Hoare’s Proof System ( partial correctness) Dijkstra’s Predicate Transformer ( total correctness) Assertion Logic formula involving program variables, arithmetic/boolean operations, etc. Hoare Triples : {P}  S  {Q} pre-condition statements post- condition
cs784(Prasad) L189wp 5 Swap Example { x =  n    and  y =  m  }     t  :=  x;     x  :=  y;     y  :=  t; { x =  m    and  y =  n   } program variables vs ghost/logic variables States : Variables - Values Assertions : States - Boolean

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

View Full Document
cs784(Prasad) L189wp 6 Partial vs Total Correctness {P}  S  {Q} is partially partially correct for P and Q   if and only if whenever S is executed in a state satisfying P and the execution terminates, then the resulting state satisfies Q . is totally totally correct for P and Q   if and only if whenever S is executed in a state satisfying P , then the execution terminates, and the resulting state satisfies Q .
cs784(Prasad) L189wp 7 Examples Totally correct (hence, partially correct) { false }  x := 0;  { x  = 111 } { x = 11 }  x := 0;  { x  = 0 }

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 25

L189WP - Axiomatic Semantics Predicate Transformers...

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

View Full Document
Ask a homework question - tutors are online