Exemple #1
0
def Zn(n):
    '''
        Group of integers under addition modulo n
    '''
    addXY = lambda x, y : (x + y) % n
    add_op = OperationFactory.create_operation(addXY, numeric_set.Zn(n))
    return FiniteGroupFactory.create_group(add_op.get_set(), add_op)
Exemple #2
0
def FiniteDirectSum(*rings):
    '''
        Given rings R1, R2, ..., represents
        the set R1 (+) R2 (+) ...
    '''
    mulXY = lambda x, y : tuple([rings[i].multiply(x[i], y[i]) for i in range(len(rings))])
    add_group = gFiniteDirectSum(*[ring.get_additive_group() for ring in rings])
    mult_op = OperationFactory.create_operation(mulXY, add_group)
    return FiniteRingFactory.create_ring(add_group, mult_op)
Exemple #3
0
def Zn(n):
    multXY = lambda x, y : (x * y) % n
    mult_op = OperationFactory.create_operation(multXY, gZn(n))
    return FiniteRingFactory.create_ring(gZn(n), mult_op)