Beispiel #1
0
        def coproduct(self):
            """
            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 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.coproduct_on_basis)
            elif hasattr(self, "coproduct_by_coercion"):
                return self.coproduct_by_coercion
        def coproduct(self):
            """
            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 #3
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
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: 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:
                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 #5
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 #6
0
    def coproduct_on_basis(self, g):
        r"""
        Coproduct, on basis elements, as per :meth:`HopfAlgebrasWithBasis.ParentMethods.coproduct_on_basis`.

        The basis elements are group like: `\Delta(g) = g \otimes g`.

        EXAMPLES::

            sage: A = HopfAlgebrasWithBasis(QQ).example()
            sage: (a, b) = A._group.gens()
            sage: A.coproduct_on_basis(a)
            B[(1,2,3)] # B[(1,2,3)]
        """
        g = self.monomial(g)
        return tensor([g, g])
    def coproduct_on_basis(self, g):
        r"""
        Coproduct, on basis elements, as per :meth:`HopfAlgebrasWithBasis.ParentMethods.coproduct_on_basis`.

        The basis elements are group like: `\Delta(g) = g \otimes g`.

        EXAMPLES::

            sage: A = HopfAlgebrasWithBasis(QQ).example()
            sage: (a, b) = A._group.gens()
            sage: A.coproduct_on_basis(a)
            B[(1,2,3)] # B[(1,2,3)]
        """
        g = self.monomial(g)
        return tensor([g, g])
Beispiel #8
0
    def coproduct_on_basis(self, g):
        r"""
        Coproduct, on basis elements, as per :meth:`HopfAlgebrasWithBasis.ParentMethods.coproduct_on_basis`.

        The basis elements are group-like: `\Delta(g) = g \otimes g`.

        EXAMPLES::

            sage: A = GroupAlgebra(DihedralGroup(3), QQ)
            sage: (a, b) = A._group.gens()
            sage: A.coproduct_on_basis(a)
            (1,2,3) # (1,2,3)
        """
        from sage.categories.all import tensor
        g = self.monomial(g)
        return tensor([g, g])
Beispiel #9
0
        def internal_coproduct_by_coercion(self, x):
            r"""
            Return the internal coproduct by coercing the element to the powersum basis.

            INPUT:

            - ``x`` -- an element of ``self``

            OUTPUT:

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

            EXAMPLES::

                sage: h = SymmetricFunctionsNonCommutingVariables(QQ).h()
                sage: h[[1,3],[2]].internal_coproduct() # indirect doctest
                2*h{{1}, {2}, {3}} # h{{1}, {2}, {3}} - h{{1}, {2}, {3}} # h{{1, 3}, {2}}
                 - h{{1, 3}, {2}} # h{{1}, {2}, {3}} + h{{1, 3}, {2}} # h{{1, 3}, {2}}
            """
            R = self.realization_of().a_realization()
            return self.tensor_square().sum(coeff * tensor([self(R[A]), self(R[B])])
                                            for ((A, B), coeff) in R(x).internal_coproduct())
Beispiel #10
0
        def internal_coproduct_by_coercion(self, x):
            r"""
            Return the internal coproduct by coercing the element to the powersum basis.

            INPUT:

            - ``x`` -- an element of ``self``

            OUTPUT:

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

            EXAMPLES::

                sage: h = SymmetricFunctionsNonCommutingVariables(QQ).h()
                sage: h[[1,3],[2]].internal_coproduct() # indirect doctest
                2*h{{1}, {2}, {3}} # h{{1}, {2}, {3}} - h{{1}, {2}, {3}} # h{{1, 3}, {2}}
                 - h{{1, 3}, {2}} # h{{1}, {2}, {3}} + h{{1, 3}, {2}} # h{{1, 3}, {2}}
            """
            R = self.realization_of().a_realization()
            return self.tensor_square().sum(coeff * tensor([self(R[A]), self(R[B])])
                                            for ((A, B), coeff) in R(x).internal_coproduct())
        def coproduct_iterated(self, n=1):
            r"""
            Apply ``n`` coproducts to ``self``.

            .. TODO::

                Remove dependency on ``modules_with_basis`` methods.

            EXAMPLES::

                sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
                sage: Psi[2,2].coproduct_iterated(0)
                Psi[2, 2]
                sage: Psi[2,2].coproduct_iterated(2)
                Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[2] # Psi[2]
                 + Psi[] # Psi[2, 2] # Psi[] + 2*Psi[2] # Psi[] # Psi[2]
                 + 2*Psi[2] # Psi[2] # Psi[] + Psi[2, 2] # Psi[] # Psi[]

            TESTS::

                sage: p = SymmetricFunctions(QQ).p()
                sage: p[5,2,2].coproduct_iterated()
                p[] # p[5, 2, 2] + 2*p[2] # p[5, 2] + p[2, 2] # p[5]
                 + p[5] # p[2, 2] + 2*p[5, 2] # p[2] + p[5, 2, 2] # p[]
                sage: p([]).coproduct_iterated(3)
                p[] # p[] # p[] # p[]

            ::

                sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
                sage: Psi[2,2].coproduct_iterated(0)
                Psi[2, 2]
                sage: Psi[2,2].coproduct_iterated(3)
                Psi[] # Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[] # Psi[2] # Psi[2]
                 + Psi[] # Psi[] # Psi[2, 2] # Psi[] + 2*Psi[] # Psi[2] # Psi[] # Psi[2]
                 + 2*Psi[] # Psi[2] # Psi[2] # Psi[] + Psi[] # Psi[2, 2] # Psi[] # Psi[]
                 + 2*Psi[2] # Psi[] # Psi[] # Psi[2] + 2*Psi[2] # Psi[] # Psi[2] # Psi[]
                 + 2*Psi[2] # Psi[2] # Psi[] # Psi[] + Psi[2, 2] # Psi[] # Psi[] # Psi[]

            ::

                sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
                sage: m[[1,3],[2]].coproduct_iterated(2)
                m{} # m{} # m{{1, 3}, {2}} + m{} # m{{1}} # m{{1, 2}}
                 + m{} # m{{1, 2}} # m{{1}} + m{} # m{{1, 3}, {2}} # m{}
                 + m{{1}} # m{} # m{{1, 2}} + m{{1}} # m{{1, 2}} # m{}
                 + m{{1, 2}} # m{} # m{{1}} + m{{1, 2}} # m{{1}} # m{}
                 + m{{1, 3}, {2}} # m{} # m{}
                sage: m[[]].coproduct_iterated(3), m[[1,3],[2]].coproduct_iterated(0)
                (m{} # m{} # m{} # m{}, m{{1, 3}, {2}})
            """
            if n < 0:
                raise ValueError(
                    "cannot take fewer than 0 coproduct iterations: %s < 0" %
                    str(n))
            if n == 0:
                return self
            if n == 1:
                return self.coproduct()
            from sage.functions.all import floor, ceil
            from sage.rings.all import Integer

            # Use coassociativity of `\Delta` to perform many coproducts simultaneously.
            fn = floor(Integer(n - 1) / 2)
            cn = ceil(Integer(n - 1) / 2)
            split = lambda a, b: tensor(
                [a.coproduct_iterated(fn),
                 b.coproduct_iterated(cn)])
            return self.coproduct().apply_multilinear_morphism(split)
Beispiel #12
0
        def coproduct_iterated(self, n=1):
            r"""
            Apply ``n`` coproducts to ``self``.

            .. TODO::

                Remove dependency on ``modules_with_basis`` methods.

            EXAMPLES::

                sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
                sage: Psi[2,2].coproduct_iterated(0)
                Psi[2, 2]
                sage: Psi[2,2].coproduct_iterated(2)
                Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[2] # Psi[2]
                 + Psi[] # Psi[2, 2] # Psi[] + 2*Psi[2] # Psi[] # Psi[2]
                 + 2*Psi[2] # Psi[2] # Psi[] + Psi[2, 2] # Psi[] # Psi[]

            TESTS::

                sage: p = SymmetricFunctions(QQ).p()
                sage: p[5,2,2].coproduct_iterated()
                p[] # p[5, 2, 2] + 2*p[2] # p[5, 2] + p[2, 2] # p[5]
                 + p[5] # p[2, 2] + 2*p[5, 2] # p[2] + p[5, 2, 2] # p[]
                sage: p([]).coproduct_iterated(3)
                p[] # p[] # p[] # p[]

            ::

                sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
                sage: Psi[2,2].coproduct_iterated(0)
                Psi[2, 2]
                sage: Psi[2,2].coproduct_iterated(3)
                Psi[] # Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[] # Psi[2] # Psi[2]
                 + Psi[] # Psi[] # Psi[2, 2] # Psi[] + 2*Psi[] # Psi[2] # Psi[] # Psi[2]
                 + 2*Psi[] # Psi[2] # Psi[2] # Psi[] + Psi[] # Psi[2, 2] # Psi[] # Psi[]
                 + 2*Psi[2] # Psi[] # Psi[] # Psi[2] + 2*Psi[2] # Psi[] # Psi[2] # Psi[]
                 + 2*Psi[2] # Psi[2] # Psi[] # Psi[] + Psi[2, 2] # Psi[] # Psi[] # Psi[]

            ::

                sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
                sage: m[[1,3],[2]].coproduct_iterated(2)
                m{} # m{} # m{{1, 3}, {2}} + m{} # m{{1}} # m{{1, 2}}
                 + m{} # m{{1, 2}} # m{{1}} + m{} # m{{1, 3}, {2}} # m{}
                 + m{{1}} # m{} # m{{1, 2}} + m{{1}} # m{{1, 2}} # m{}
                 + m{{1, 2}} # m{} # m{{1}} + m{{1, 2}} # m{{1}} # m{}
                 + m{{1, 3}, {2}} # m{} # m{}
                sage: m[[]].coproduct_iterated(3), m[[1,3],[2]].coproduct_iterated(0)
                (m{} # m{} # m{} # m{}, m{{1, 3}, {2}})
            """
            if n < 0:
                raise ValueError("cannot take fewer than 0 coproduct iterations: %s < 0" % str(n))
            if n == 0:
                return self
            if n == 1:
                return self.coproduct()
            from sage.functions.all import floor, ceil
            from sage.rings.all import Integer

            # Use coassociativity of `\Delta` to perform many coproducts simultaneously.
            fn = floor(Integer(n-1)/2); cn = ceil(Integer(n-1)/2)
            split = lambda a,b: tensor([a.coproduct_iterated(fn), b.coproduct_iterated(cn)])
            return self.coproduct().apply_multilinear_morphism(split)