def module_test(self): return frozenset([CON.Eq(TA.f(TA.C(1)),\ TA.Z(self._n+1,TA.f(TA.C(1))))])
bound to mul(..) and '.' is bound to Zlmul(..)""" raise Exception('Ring does not give terms in generators for elements!') def test(self): """Returns a set of EquivalenceTermConstraints that is sufficient to tell whether a morphism defined by the images of gen() that respects 0 and 1 is also a RingHom""" raise Exception('Ring does not have a testing set for homomorphisms') def module_test(self): """Returns a set of EquivalenceTermConstraints that is sufficient to tell whether a morphism defined by the images of the unit as generating set for the ring viewed as module that respects the 0.""" raise Exception('Ring does not have a testing set for module homomorphisms') testRingHom = CON.Eq(TA.C(0),TA.f(TA.C(0))) & CON.Eq(TA.C(1),TA.f(TA.C(1))) class RingHom(object): """Base class for ring homomorphisms""" def __init__(self): raise Exception\ ('RingHom is an abstract class that cannot be instantiated') def __contains__(self,item): """Returns true, if item is a pair (x,y) with y = f(x)""" if type(item) == tuple: if len(item) == 2: if item[0] in self.dom() and \ item[1] in self.cod(): return item[1] == self(item[0]) return False