Finish the proof of the algorithm