def __init__(self, basis, check=True):
        """
        EXAMPLES::

            sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]; L.<Y> = K.extension(y^4 + x*y + 4*x + 1); S = L.equation_order()
            sage: S
            Order in Function field in Y defined by y^4 + x*y + 4*x + 1
            sage: type(S)
            <class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_basis'>
        """
        if len(basis) == 0:
            raise ValueError, "basis must have positive length"
        
        fraction_field = basis[0].parent()
        if len(basis) != fraction_field.degree():
            raise ValueError, "length of basis must equal degree of field"
        
        FunctionFieldOrder.__init__(self, fraction_field)
        
        self._basis = tuple(basis)
        V, fr, to = fraction_field.vector_space()
        R = fraction_field.base_field().maximal_order()
        self._module = V.span([to(b) for b in basis], base_ring=R)
        self._ring = fraction_field.polynomial_ring()
        self._populate_coercion_lists_(coerce_list=[self._ring])
        if check:
            if self._module.rank() != fraction_field.degree():
                raise ValueError, "basis is not a basis"
        IntegralDomain.__init__(self, self, names = fraction_field.variable_names(), normalize = False)
Exemplo n.º 2
0
    def __init__(self, basis, check=True):
        """
        EXAMPLES::

            sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]; L.<Y> = K.extension(y^4 + x*y + 4*x + 1); S = L.equation_order()
            sage: S
            Order in Function field in Y defined by y^4 + x*y + 4*x + 1
            sage: type(S)
            <class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_basis'>
        """
        if len(basis) == 0:
            raise ValueError("basis must have positive length")

        fraction_field = basis[0].parent()
        if len(basis) != fraction_field.degree():
            raise ValueError("length of basis must equal degree of field")

        FunctionFieldOrder.__init__(self, fraction_field)

        self._basis = tuple(basis)
        V, fr, to = fraction_field.vector_space()
        R = fraction_field.base_field().maximal_order()
        self._module = V.span([to(b) for b in basis], base_ring=R)
        self._ring = fraction_field.polynomial_ring()
        self._populate_coercion_lists_(coerce_list=[self._ring])
        if check:
            if self._module.rank() != fraction_field.degree():
                raise ValueError("basis is not a basis")
        IntegralDomain.__init__(self,
                                self,
                                names=fraction_field.variable_names(),
                                normalize=False)
Exemplo n.º 3
0
    def __init__(self, base, constants=QQ, category=None):
        ## Checking the arguments
        if (not (constants in Fields())):
            raise TypeError("The argument 'constants' must be a Field")
        if (not (isinstance(base, Ring_w_Sequence))):
            raise TypeError("The argument 'base' must be a Ring with Sequence")

        ## Initializing the parent structures
        ConversionSystem.__init__(self, base)
        IntegralDomain.__init__(self, base, category)

        ## Initializing the attributes
        self.__constants = constants

        self.__poly_ring = None
        self._change_poly_ring(constants)

        ## Initializing the map of variables (if there is enough)
        self.__map_of_vars = {}

        ## Initializing the map of derivatives
        self.__map_of_derivatives = {}

        ## Casting and Coercion system
        self.base().register_conversion(LRSimpleMorphism(self, self.base()))

        ## Auxiliary data
        self.__var_name = "x"
        self.__version = 1
Exemplo n.º 4
0
    def __init__(self, basis, check=True):
        """
        EXAMPLES::

            sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]
            sage: L.<y> = K.extension(y^4 + x*y + 4*x + 1)
            sage: O = L.equation_order(); O
            Order in Function field in y defined by y^4 + x*y + 4*x + 1
            sage: type(O)
            <class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_basis_with_category'>

        The basis only defines an order if the module it generates is closed under multiplication
         and contains the identity element (only checked when ``check`` is True)::

            sage: K.<x> = FunctionField(QQ)
            sage: R.<y> = K[]
            sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x));
            sage: y.is_integral()
            False
            sage: L.order(y)
            Traceback (most recent call last):
            ...
            ValueError: The module generated by basis [1, y, y^2, y^3, y^4] must be closed under multiplication

        The basis also has to be linearly independent and of the same rank as the degree of the function field of its elements (only checked when ``check`` is True)::

            sage: L.order(L(x))
            Traceback (most recent call last):
            ...
            ValueError: Basis [1, x, x^2, x^3, x^4] is not linearly independent
            sage: sage.rings.function_field.function_field_order.FunctionFieldOrder_basis([y,y,y^3,y^4,y^5])
            Traceback (most recent call last):
            ...
            ValueError: Basis [y, y, y^3, y^4, 2*x*y + (x^4 + 1)/x] is not linearly independent
        """
        if len(basis) == 0:
            raise ValueError("basis must have positive length")

        fraction_field = basis[0].parent()
        if len(basis) != fraction_field.degree():
            raise ValueError("length of basis must equal degree of field")

        FunctionFieldOrder.__init__(self, fraction_field)

        self._basis = tuple(basis)
        V, fr, to = fraction_field.vector_space()
        R = fraction_field.base_field().maximal_order()
        self._module = V.span([to(b) for b in basis], base_ring=R)
        self._ring = fraction_field.polynomial_ring()
        self._populate_coercion_lists_(coerce_list=[self._ring])
        if check:
            if self._module.rank() != fraction_field.degree():
                raise ValueError("Basis %s is not linearly independent"%(basis))
            if not to(fraction_field(1)) in self._module:
                raise ValueError("The identity element must be in the module spanned by basis %s"%(basis))
            if not all(to(a*b) in self._module for a in basis for b in basis):
                raise ValueError("The module generated by basis %s must be closed under multiplication"%(basis))
        IntegralDomain.__init__(self, self, names = fraction_field.variable_names(), normalize = False)
Exemplo n.º 5
0
    def __init__(self, basis, check=True):
        """
        EXAMPLES::

            sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]
            sage: L.<y> = K.extension(y^4 + x*y + 4*x + 1)
            sage: O = L.equation_order(); O
            Order in Function field in y defined by y^4 + x*y + 4*x + 1
            sage: type(O)
            <class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_basis_with_category'>

        The basis only defines an order if the module it generates is closed under multiplication
         and contains the identity element (only checked when ``check`` is True)::

            sage: K.<x> = FunctionField(QQ)
            sage: R.<y> = K[]
            sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x));
            sage: y.is_integral()
            False
            sage: L.order(y)
            Traceback (most recent call last):
            ...
            ValueError: The module generated by basis [1, y, y^2, y^3, y^4] must be closed under multiplication

        The basis also has to be linearly independent and of the same rank as the degree of the function field of its elements (only checked when ``check`` is True)::

            sage: L.order(L(x))
            Traceback (most recent call last):
            ...
            ValueError: Basis [1, x, x^2, x^3, x^4] is not linearly independent
            sage: sage.rings.function_field.function_field_order.FunctionFieldOrder_basis([y,y,y^3,y^4,y^5])
            Traceback (most recent call last):
            ...
            ValueError: Basis [y, y, y^3, y^4, 2*x*y + (x^4 + 1)/x] is not linearly independent
        """
        if len(basis) == 0:
            raise ValueError("basis must have positive length")

        fraction_field = basis[0].parent()
        if len(basis) != fraction_field.degree():
            raise ValueError("length of basis must equal degree of field")

        FunctionFieldOrder.__init__(self, fraction_field)

        self._basis = tuple(basis)
        V, fr, to = fraction_field.vector_space()
        R = fraction_field.base_field().maximal_order()
        self._module = V.span([to(b) for b in basis], base_ring=R)
        self._ring = fraction_field.polynomial_ring()
        self._populate_coercion_lists_(coerce_list=[self._ring])
        if check:
            if self._module.rank() != fraction_field.degree():
                raise ValueError("Basis %s is not linearly independent"%(basis))
            if not to(fraction_field(1)) in self._module:
                raise ValueError("The identity element must be in the module spanned by basis %s"%(basis))
            if not all(to(a*b) in self._module for a in basis for b in basis):
                raise ValueError("The module generated by basis %s must be closed under multiplication"%(basis))
        IntegralDomain.__init__(self, self, names = fraction_field.variable_names(), normalize = False)
Exemplo n.º 6
0
 def __init__(self, base):
     if base not in IntegralDomains():
         raise ValueError("%s is no integral domain" % base);
     IntegralDomain.__init__(self, base, category=IntegralDomains());
     
     self._zero_element = SimpleLIDElement(self, base.zero());
     self._one_element = SimpleLIDElement(self, base.one());
     
     self.base().register_conversion(LIDSimpleMorphism(self, self.base()));
Exemplo n.º 7
0
    def __init__(self, fraction_field):
        """
        INPUT:

            - ``fraction_field`` -- the function field in which this is an order.

        EXAMPLES::

            sage: R = FunctionField(QQ,'y').maximal_order()
            sage: isinstance(R, sage.rings.function_field.function_field_order.FunctionFieldOrder)
            True
        """
        IntegralDomain.__init__(self, self)
        self._fraction_field = fraction_field
Exemplo n.º 8
0
    def __init__(self, fraction_field):
        """
        INPUT:

            - ``fraction_field`` -- the function field in which this is an order.

        EXAMPLES::

            sage: R = FunctionField(QQ,'y').maximal_order()
            sage: isinstance(R, sage.rings.function_field.function_field_order.FunctionFieldOrder)
            True
        """
        IntegralDomain.__init__(self, self)
        self._fraction_field = fraction_field
Exemplo n.º 9
0
    def __init__(self,
                 base_ring,
                 additional_units,
                 names=None,
                 normalize=True,
                 category=None,
                 warning=True):
        """
        Python constructor of Localization.

        TESTS::

            sage: L = Localization(ZZ, (3,5))
            sage: TestSuite(L).run()

            sage: R.<x> = ZZ[]
            sage: L = R.localization(x**2+1)
            sage: TestSuite(L).run()
        """
        if type(additional_units) is tuple:
            additional_units = list(additional_units)
        if not type(additional_units) is list:
            additional_units = [additional_units]

        if isinstance(base_ring, Localization):
            # don't allow recursive constructions
            additional_units += base_ring._additional_units
            base_ring = base_ring.base_ring()

        additional_units = normalize_additional_units(base_ring,
                                                      additional_units,
                                                      warning=warning)

        if not additional_units:
            raise ValueError('all given elements are invertible in %s' %
                             (base_ring))

        if category is None:
            # since by construction the base ring must contain non units self must be infinite
            category = IntegralDomains().Infinite()

        IntegralDomain.__init__(self,
                                base_ring,
                                names=None,
                                normalize=True,
                                category=category)
        self._additional_units = tuple(additional_units)
        self._fraction_field = base_ring.fraction_field()
        self._populate_coercion_lists_()
Exemplo n.º 10
0
 def __init__(self, function_field):
     """
     EXAMPLES::
     
         sage: K.<t> = FunctionField(GF(19)); K
         Rational function field in t over Finite Field of size 19
         sage: R = K.maximal_order(); R
         Maximal order in Rational function field in t over Finite Field of size 19
         sage: type(R)
         <class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_rational'>
     """
     FunctionFieldOrder.__init__(self, function_field)
     IntegralDomain.__init__(self, self, names = function_field.variable_names(), normalize = False)
     self._ring = function_field._ring
     self._populate_coercion_lists_(coerce_list=[self._ring])
     self._gen = self(self._ring.gen())
     self._basis = (self(1),)
Exemplo n.º 11
0
 def __init__(self, base, constants=QQ, var_name="z", category=None):
     '''
         Implementation of a Covnersion System using InfinitePolynomialRing as a basic structure.
         
         Elements of 'base' will be represented in this ring using elements of
         'InfinitePolynomialRing(constants, names=[var_name])' and linear relations of the type
         'f = cg+d' where 'f in base', 'g in self.gens()' and 'c,d in constants'.
         
         This class captures all the functionality to work as a ConversionSystem and all the
         data structures required for ompting lazily with those objects.
     '''
     ## Checking the arguments
     if(not (constants in Fields())):
         raise TypeError("The argument 'constants' must be a Field");
     if(not (isinstance(base, Ring_w_Sequence))):
         raise TypeError("The argument 'base' must be a Ring with Sequence");
         
     ## Initializing the parent structures
     ConversionSystem.__init__(self, base);
     IntegralDomain.__init__(self, base, category);
     
     ## Initializing the attributes
     self.__constants = constants;
     
     self.__poly_ring = InfinitePolynomialRing(constants, names=[var_name]);
     self.__poly_field = self.__poly_ring.fraction_field();
     self.__gen = self.__poly_ring.gens()[0];
     self.__used = 0;
     
     ## Initializing the map of variables
     self.__map_of_vars = {}; # Map where each variable is associated with a 'base' object
     self.__map_to_vars = {}; # Map where each variable is associated with a 'base' object
     self.__r_graph = DiGraph(); # Graph of relations between the already casted elements
     self.__trans = dict(); # Dictionary with the transformation to get into a node in 'r_graph'
     
     self.__gens = [];
     
     self.__map_of_derivatives = {}; # Map for each variable to its derivative (as a polynomial)
         
     ## Casting and Coercion system
     self.base().register_conversion(LDRSimpleMorphism(self, self.base()));
     
     ## Adding the 'x' as a basic variable in the ring
     self(DFinite.element([0,0,1],[0,1],name="x"));                 
Exemplo n.º 12
0
 def __init__(self, function_field):
     """
     EXAMPLES::
     
         sage: K.<t> = FunctionField(GF(19)); K
         Rational function field in t over Finite Field of size 19
         sage: R = K.maximal_order(); R
         Maximal order in Rational function field in t over Finite Field of size 19
         sage: type(R)
         <class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_rational'>
     """
     FunctionFieldOrder.__init__(self, function_field)
     IntegralDomain.__init__(self,
                             self,
                             names=function_field.variable_names(),
                             normalize=False)
     self._ring = function_field._ring
     self._populate_coercion_lists_(coerce_list=[self._ring])
     self._gen = self(self._ring.gen())
     self._basis = (self(1), )