Exercise 4: Lift out constant expressions

This is slightly simplified - I’m ignoring if-then-else blocks which
might not be optimised ideally.