This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 536 Activities: Sample Correctness Triples and Simple Proof Rules Activity 5.1: Program Semantics A. Why? • Correctness triples are how we write a program with its speci cation. • Proof rules for correctness triples will show us how to reason about programs and their speci cations. B. Outcomes At the end of this activity you should: • Be able to write a program speci cation given a simple English description of it. • Be able to modify a program’s speci cations to vary the amount of detail it gives about the program’s behavior C. Questions 1. Give a precondition and postcondition for a program that should set sum to the sum of the rst n integers, assuming n " 0. What do you think the program should do if n is < 0? Try to make the postcondition talk about this. 2. Repeat Question 1 for an integer square root program (the integer square root of n is x where x squared is less than or equal to n but n is less than (x+1) squared)....
View
Full
Document
 Fall '08
 cs536
 Substitute good, Illinois Institute of Technology, James Sasaki, integer square root

Click to edit the document details