 
Summary: CMPS 282: Software Engineering, Spring 201011 Instructor: Paul Attie
Problem set 5 Due: Wednesday April 20
Department of Computer Science American University of Beirut
All variables used are integer type, unless declared otherwise. In all your answers, provide full
anotations similar to the examples that I have presented in class. When finding a postcondition,
you should find the stongest postcondition that you can, i.e., the postcondition that provides
the most information. For example, true is always a valid postcondition, but also a useless one.
1. (5 points each) Find and simplify the postcondition Q(x) so that the following Hoare
triples are valid.
a) {x < 27}
x := x + 5;
{Q(x)}
b) {x = 27}
x := x + 5;
{Q(x)}
c) {x > 27}
x := x + 5;
{Q(x)}
2. (10 points each) Find and simplify the postcondition Q(x, y) so that the following Hoare
triples are valid.
