Act05_Sample_triples_and_proof_rules

Act05_Sample_triples_and_proof_rules - CS 536 Activities:...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 2

Act05_Sample_triples_and_proof_rules - CS 536 Activities:...

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

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