Act05_Sample_triples_and_proof_rules

Act05_Sample_triples_and_proof_rules - CS 536 Activities...

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
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 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

{[ snackBarMessage ]}

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
Ask a homework question - tutors are online