Edited algo1_proof from theorem 1