Added substitution lemma for equivalence calculations