Exercise 4.2 resolved