L189WP - Axiomatic Semantics Predicate Transformers...

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

View Full Document Right Arrow Icon
cs784(Prasad) L189wp 1 Axiomatic Semantics Predicate Transformer s
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
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 .
Background image of page 6
cs784(Prasad) L189wp 7 Examples Totally correct (hence, partially correct) { false }  x := 0;  { x  = 111 } { x = 11 }  x := 0;  { x  = 0 }
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/02/2011 for the course CS cs784 taught by Professor Tkprasad during the Spring '11 term at New York Institute of Technology-Westbury.

Page1 / 25

L189WP - Axiomatic Semantics Predicate Transformers...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online