verifying if two states are equivalent