This preview shows pages 1–2. 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: 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 programs speci cations to vary the amount of detail it gives about the programs 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

Click to edit the document details