def _coerce_map_from_(self, R):
        r"""
        Return a coerce map from ``R`` to this field.

        EXAMPLES::

            sage: R.<t> = GF(5)[]
            sage: K = R.fraction_field()
            sage: L = K.function_field()
            sage: f = K.coerce_map_from(L); f # indirect doctest
            Isomorphism:
              From: Rational function field in t over Finite Field of size 5
              To:   Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
            sage: f(~L.gen())
            1/t

        """
        from sage.rings.function_field.function_field import is_RationalFunctionField
        if is_RationalFunctionField(R) and self.variable_name() == R.variable_name() and self.base_ring() is R.constant_base_field():
            from sage.categories.all import Hom
            parent = Hom(R, self)
            from sage.rings.function_field.maps import FunctionFieldToFractionField
            return parent.__make_element_class__(FunctionFieldToFractionField)(parent)

        return super(FractionField_1poly_field, self)._coerce_map_from_(R)
Beispiel #2
0
        def internal_coproduct(self):
            """
            Compute the internal coproduct of ``self``.

            If :meth:`internal_coproduct_on_basis()` is available, construct
            the internal coproduct morphism from ``self`` to ``self``
            `\otimes` ``self`` by extending it by linearity. Otherwise, this uses
            :meth:`internal_coproduct_by_coercion()`, if available.

            OUTPUT:

            - an element of the tensor squared of ``self``

            EXAMPLES::

                sage: q = SymmetricFunctionsNonCommutingVariables(QQ).q()
                sage: q.internal_coproduct(q[[1,3],[2]] - 2*q[[1]])
                -2*q{{1}} # q{{1}} + q{{1, 2, 3}} # q{{1, 3}, {2}} + q{{1, 3}, {2}} # q{{1, 2, 3}}
                 + q{{1, 3}, {2}} # q{{1, 3}, {2}}
            """
            if self.internal_coproduct_on_basis is not NotImplemented:
                # TODO: if self is a coalgebra, then one would want
                # to create a morphism of algebras with basis instead
                # should there be a method self.coproduct_hom_category?
                return Hom(self, tensor([self, self]),
                           ModulesWithBasis(self.base_ring()))(
                               on_basis=self.internal_coproduct_on_basis)
            elif hasattr(self, "internal_coproduct_by_coercion"):
                return self.internal_coproduct_by_coercion
Beispiel #3
0
        def coproduct(self):
            r"""
            If :meth:`coproduct_on_basis` is available, construct the
            coproduct morphism from ``self`` to ``self`` `\otimes`
            ``self`` by extending it by linearity. Otherwise, use
            :meth:`~Coalgebras.Realizations.ParentMethods.coproduct_by_coercion`,
            if available.

            EXAMPLES::

                sage: A = HopfAlgebrasWithBasis(QQ).example(); A
                An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field
                sage: [a,b] = A.algebra_generators()
                sage: a, A.coproduct(a)
                (B[(1,2,3)], B[(1,2,3)] # B[(1,2,3)])
                sage: b, A.coproduct(b)
                (B[(1,3)], B[(1,3)] # B[(1,3)])

            """
            if self.coproduct_on_basis is not NotImplemented:
                # TODO: if self is a hopf algebra, then one would want
                # to create a morphism of algebras with basis instead
                # should there be a method self.coproduct_homset_category?
                return Hom(self, tensor([self, self]),
                           ModulesWithBasis(self.base_ring()))(
                               on_basis=self.coproduct_on_basis)
            elif hasattr(self, "coproduct_by_coercion"):
                return self.coproduct_by_coercion
Beispiel #4
0
        def internal_coproduct(self):
            """
            Compute the internal coproduct of ``self``.

            If :meth:`internal_coproduct_on_basis()` is available, construct
            the internal coproduct morphism from ``self`` to ``self``
            `\otimes` ``self`` by extending it by linearity. Otherwise, this uses
            :meth:`internal_coproduct_by_coercion()`, if available.

            OUTPUT:

            - an element of the tensor squared of ``self``

            EXAMPLES::

                sage: cp = SymmetricFunctionsNonCommutingVariables(QQ).cp()
                sage: cp.internal_coproduct(cp[[1,3],[2]] - 2*cp[[1]])
                -2*cp{{1}} # cp{{1}} + cp{{1, 2, 3}} # cp{{1, 3}, {2}} + cp{{1, 3}, {2}} # cp{{1, 2, 3}}
                 + cp{{1, 3}, {2}} # cp{{1, 3}, {2}}
            """
            if self.internal_coproduct_on_basis is not NotImplemented:
                return Hom(self, tensor([self, self]),
                           ModulesWithBasis(self.base_ring()))(
                               on_basis=self.internal_coproduct_on_basis)
            elif hasattr(self, "internal_coproduct_by_coercion"):
                return self.internal_coproduct_by_coercion
    def _apply_functor_to_morphism(self, f):
        r"""
        Lift a homomorphism of rings to the corresponding homomorphism of the group algebras of ``self.group()``.
        
        INPUT:
        
        - ``f`` - a morphism of rings.

        OUTPUT:

        A morphism of group algebras.

        EXAMPLES::
        
            sage: G = SymmetricGroup(3)
            sage: A = GroupAlgebra(G, ZZ)
            sage: h = sage.categories.morphism.SetMorphism(Hom(ZZ, GF(5), Rings()), lambda x: GF(5)(x))
            sage: hh = A.construction()[0](h)
            sage: hh(A.0 + 5 * A.1)
            (1,2,3)
        """
        codomain = self(f.codomain())
        return SetMorphism(
            Hom(self(f.domain()), codomain, Rings()), lambda x: sum(
                codomain(g) * f(c) for (g, c) in dict(x).iteritems()))
Beispiel #6
0
    def _coerce_map_from_(self, R):
        r"""
        Return a coerce map from ``R`` to this field.

        EXAMPLES::

            sage: R.<t> = GF(5)[]
            sage: K = R.fraction_field()
            sage: L = K.function_field()
            sage: f = K.coerce_map_from(L); f # indirect doctest
            Isomorphism:
              From: Rational function field in t over Finite Field of size 5
              To:   Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
            sage: f(~L.gen())
            1/t

        """
        from sage.rings.function_field.function_field import RationalFunctionField
        if isinstance(R, RationalFunctionField) and self.variable_name(
        ) == R.variable_name() and self.base_ring() is R.constant_base_field():
            from sage.categories.all import Hom
            parent = Hom(R, self)
            from sage.rings.function_field.maps import FunctionFieldToFractionField
            return parent.__make_element_class__(FunctionFieldToFractionField)(
                parent)

        return super(FractionField_1poly_field, self)._coerce_map_from_(R)
Beispiel #7
0
    def section(self):
        r"""
        Return a section of this map.

        EXAMPLES::

            sage: R.<x> = QQ[]
            sage: R.fraction_field().coerce_map_from(R).section()
            Section map:
              From: Fraction Field of Univariate Polynomial Ring in x over Rational Field
              To:   Univariate Polynomial Ring in x over Rational Field

        """
        from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
        from sage.all import Hom
        parent = Hom(self.codomain(), self.domain(), SetsWithPartialMaps())
        return parent.__make_element_class__(FractionFieldEmbeddingSection)(self)
    def section(self):
        r"""
        Return a section of this map.

        EXAMPLES::

            sage: R.<x> = QQ[]
            sage: R.fraction_field().coerce_map_from(R).section()
            Section map:
              From: Fraction Field of Univariate Polynomial Ring in x over Rational Field
              To:   Univariate Polynomial Ring in x over Rational Field

        """
        from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
        from sage.all import Hom
        parent = Hom(self.codomain(), self.domain(), SetsWithPartialMaps())
        return parent.__make_element_class__(FractionFieldEmbeddingSection)(self)