Proof of correctness of the precedence graph test