Exercise 3.9 resolved