CS245 Lecture : Assignment #7 + Solution Winter 2009

248 views8 pages

Document Summary

Due: thu 26 mar 2009 10am in the cs245 drop boxes. There may be multiple correct answers to this question: (40 marks) for each of the following programs, if the program satis es its speci cation for partial correctness, use program correctness techniques to show it is correct. Use natural deduction (without transformational proof rules for propositional and predicate logic) to prove any veri cation conditions. If the program does not satisfy its speci cation, provide a counterexample and demonstrate that your counterexample does not satisfy the speci cation. 1 (a) (18 marks) (| true |) x = 2 * x; if (y >= 0) { if (y=0) { y = x + y; } else { y = 2 * y; } else { y = x + 2; (| w y = 2w |) Annotated program: (| true |) x = 2 * x; (| w x = 2w |)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Questions