#19282: Operators expander in categories
-------------------------------------+-------------------------------------
       Reporter:  elixyre            |        Owner:
           Type:  enhancement        |       Status:  new
       Priority:  major              |    Milestone:  sage-6.9
      Component:  categories         |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jean-Baptiste      |    Reviewers:
  Priez                              |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  8e35b830e77028d25e2614aadc9d0708a1872fca
  public/hopf_algebras/categories/misc|     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by zabrocki):

 * type:  PLEASE CHANGE => enhancement


Old description:

> In Sage, mathematical structures as dendrifom algebras, algebras with
> internal product, ''etc'' involve to implement operators in several
> class. For example, if I wish define a new amazing operator `foo` in the
> category `CategoryOfSomeWonderfulStructures`, I have to do that:
>
> {{{#!python
>         class CategoryOfSomeWonderfulStructures(Category):
>
>             def super_categories(self):
>                 return [...]
>
>             class ParentMethods:
>
>                 def foo(self, I):
>                     '''
>                     My amazing unary operator with definition
>                     '''
>
>             class ElementMethods:
>
>                 def foo(self):
>                     '''
>                     My amazing unary operator applied
>                     '''
>                     return self.parent().foo(self)
>
>             class WithRealizations(WithRealizationsCategory):
>                 class ParentMethods:
>
>                     def foo(self, I):
>                         return self.a_realization().foo(I)
>
>             class Realizations(RealizationsCategory):
>                 class ParentMethods:
>
>                     def foo_by_coercion(self, I):
>                         ... looking for the good realizations which knows
> how to do
>

>             class WithBasis(CategoryWithAxiom_over_base_ring):
>                 class ParentMethods:
>
>                     @abstract_method
>                     def foo_on_basis(self, i):
>                         pass
>
>                     def foo_by_linearity(self, I):
>                         return self.linear_combination(...)
> }}}
>
> I propose to provide two methods (one for unary operator and one other
> for binary operator) such that the implementation could be resume to
>
> {{{#!python
>         class CategoryOfSomeWonderfulStructures(Category):
>
>             def super_categories(self):
>                 return [...]
>
>             class ParentMethods:
>
>                 def foo(self, I):
>                     '''
>                     My amazing unary operator with definition
>                     '''
>
>         expand_unary_operator(CategoryOfSomeWonderfulStructures,
> CategoryOfSomeWonderfulStructures.ParentMethods.foo)
> }}}

New description:

 In Sage, mathematical structures as dendrifom algebras, algebras with
 internal product, scalar products, ''etc'' involve to implement operators
 in several class. For example, if I wish define a new amazing operator
 `foo` in the category `CategoryOfSomeWonderfulStructures`, I have to do:

 {{{#!python
         class CategoryOfSomeWonderfulStructures(Category):

             def super_categories(self):
                 return [...]

             class ParentMethods:

                 def foo(self, I):
                     '''
                     My amazing unary operator with definition
                     '''

             class ElementMethods:

                 def foo(self):
                     '''
                     My amazing unary operator applied
                     '''
                     return self.parent().foo(self)

             class WithRealizations(WithRealizationsCategory):
                 class ParentMethods:

                     def foo(self, I):
                         return self.a_realization().foo(I)

             class Realizations(RealizationsCategory):
                 class ParentMethods:

                     def foo_by_coercion(self, I):
                          look for a good realization which knows how to
 foo


             class WithBasis(CategoryWithAxiom_over_base_ring):
                 class ParentMethods:

                     @abstract_method
                     def foo_on_basis(self, i):
                         pass

                     def foo_by_linearity(self, I):
                         return self.linear_combination(...)
 }}}

 I propose to provide two methods (one for unary operator and one other for
 binary operator) such that the implementation could be simplified to

 {{{#!python
         class CategoryOfSomeWonderfulStructures(Category):

             def super_categories(self):
                 return [...]

             class ParentMethods:

                 def foo(self, I):
                     '''
                     My amazing unary operator with definition
                     '''

         expand_unary_operator(CategoryOfSomeWonderfulStructures,
 CategoryOfSomeWonderfulStructures.ParentMethods.foo)
 }}}

--

Comment:

 A number of previously implemented Hopf algebras could be greatly
 simplified with this code.  In QSym alone the methods: `internal_product`,
 `skew_by`, `duality_pairing`, `degree_negation`, `counit`, and probably a
 few others follow this pattern.

--
Ticket URL: <http://trac.sagemath.org/ticket/19282#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to