Checks if an algebraic structure is a ring.