Homework set 2: Formal program semantics: what's it all mean, anyway?
Due Tuesday, Mar 9.
Ex i.j denotes exercise j at end of chapter i.
Ex i.j.k denotes exercise k at end of chapter i, section j.
- Deduce Laws (7.5) and (7.6) using (7.3) and (7.4) and the basic laws in
chapter 2. Do not use the definition of wp in (7.1). (This exercise
is a slight modification of Ex 7.4.
Suggestion: Since S is held fixed in all these laws, you can use this
abbreviation: W(R) := wp(S, R).
Hints:
- It will be helpful to first prove this meta-theorem:
For any two predicates P and Q,
(P => Q) holds if and only if (P = P ^ Q) holds.
Then use substitution inferences from it (in both directions).
- Remember that our proof system only proves equalities, so the
statements to prove are
- (W(Q) => W(R)) = T, for Monotonicity, (7.5), and
- (W(Q) v W(R) => W(Q v R)) = T, for Distributivity of Disjunction, (7.6).
Thus, derive the left hand side, T, from the right hand side by a
series of equivalences.
-
In the case of Monotonicity, somewhere along the way, you use the hypothesis
Q => R, or what is the same use Q = Q ^ R, just as you would an axiom.
- Ex 7.5
- Ex 8.2
- Ex 8.5
- Ex 9.2.1 (Hint: use section 4.4)
- Ex 9.2.2