Checks if an algebraic structure is a monoid.