A proof of the correctness of some optimising techniques