Correctness of the ID Algorithm