Checks if an ideal is a principal ideal of a ring.