Summary: CMPS 282: Software Engineering, Spring 2010-11 Instructor: Paul Attie
Problem set 3 Due: Wednesday March 30
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 in the Hoare logic lecture notes. In particular, include the
loop invariant in your answer to question 12. When finding a precondition, you should find the
weakest postcondition that you can, i.e., the precondition that provides the least information.
For example, false is a precondition that makes any Hoare triple valid, but it is a useless
precondition, since it cannot be satisfied (the validity of the Hoare triple is thus vacuous).
1. (5 points) Goldbachs conjecture is:
Every even integer greater than 2 can be written as the sum of two primes,
Write a formula which expresses Goldbachs conjecture.
2. (3 points each) Given the following predicates, which have the indicated meanings:
· student(s): s is a student
· course(c): c is a course
· passed(s, c):student s has passed course c
write formulae which have the following meanings
a) student s has passed course CMPS282
b) every student has passed course CMPS282
c) every student has passed some course