Exercise 3.13 resolved