Returns the ring id for the given type if there is a CommRing instance for it.
This function will also perform sanity-checks
(e.g., the Add instance for type must be definitionally equal to the CommRing.toAdd one.)
It also caches the functions representing +, *, -, ^, and intCast.