Opened 10 years ago

Last modified 2 years ago

## #5891 closed enhancement

# Categories for the working mathematics programmer — at Initial Version

Reported by: | nthiery | Owned by: | nthiery |
---|---|---|---|

Priority: | major | Milestone: | sage-4.3 |

Component: | categories | Keywords: | categories parents |

Cc: | sage-combinat, roed, saliola | Merged in: | |

Authors: | Reviewers: | ||

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description

This (series of) patch(es) extends the Sage category framework as a design pattern for organizing generic code.

Under development on combinat.sagemath.org/patches:

- categories-nt.patch: the category framework itself

+ updates to combinatorial free modules (will be split before submission)

Related patches (will need to be applied to recover all previous functionalities):

- family_enumset-fh.patch
- enumset_unions-fh.patch
- categories-sf-nt.patch Symmetric functions
- ncsf-nt.patch Non commutative Symmetric Functions
- root_systems-4326-nt.patch

Small technical patches they depend on:

- unique_representation-5120-submitted.patch
- lazy_attributes-fixes-5783-final.patch
- element_wrapper-nt.patch
- 5598-coerce-declare.patch
- cached_in_parent_method-5449.new
- explain-pickle-v1.patch
- cPickle-copy_reg_classes-nt.patch
- cPickle-nested-classes-nt.patch
- dynamic_class-nt.patch
- compositions-cleanup-5600-nt.patch
- transitive_ideal-nt.patch

Current status:

- Documentation: sage.categories? Category quickref card sage.categories.primer? Element/Parent/Category? primer (in writing) Category? Technical background on categories Semigroups().example()?? A template of semigroup See also the discussion on sage-devel in November 2009: http://groups.google.com/group/sage-devel/msg/d4065154e2e8cbd9

- Real life applications: see related patches, automatic monoids, ...

- Categories:
- All the mathematical categories of Axiom and MuPAD
- EnumeratedSets? (with example)
- Semigroups (with example, basic methods, subquotients)
- FiniteSemigroups? (with example, cayley graphs, basic representation theory, ...)
- ModulesWithBasis? (with example, morphisms)
- HopfAlgebras? & friends (with example)
- Cleanup:
- Have unique representation by default (no need to inherit from Category_uniq)
- Have construction / reduce by default

- Functorial constructions:
- direct sum
- tensor product
- cartesian product (todo)
- dual (in progress)
- subquotient, subset, quotient (in progress)
- isomorphism type (todo)

- Homomorphisms
- Integrates with current sage morphisms
- Adds morphisms for some categories
- Some general infrastructure

- Generic test framework
- Functional, final design clear, needs cleanup (2/3 hours)

- Combinatorial free modules
- Have unique representation

- Reorganization of the Sage library to start using the category framework:
- Fixed some import loops
- Added temporary list() methods to:
- FreeModule_generic
- MatrixSpace_generic
- Set_object_enumerated
- ParentWithAdditiveAbelianGens?
- ParentWithMultiplicativeAbelianGens? They should eventually be inherited from the EnumeratedSets?() category

- ...

- Todo:
- Naming cleanup:
- Parent -> ParentMethods? (or _ParentMethods? or ?)
- Element -> ElementMethods? + move them as a nested class of ParentMethods?
- super_categories should be a method
- zero, one should be methods
- standardize the names: mult / product / multiplication / multiply?
- check -> test
- self.tester(
**keywords)** - intrusive cat.tensor_category / ...
- cat.example() -> /an_example/an_object/... ?
- class.an_instance() ?
- all_weakly_super_categories -> ?

- Category graph picture

- Naming cleanup:

- Fixes:
- Pickling: essentially works; polish the remaining
- Integration in the Sage library: some tests are broken. Help welcome!
- Pickling from old sage: technically feasible. Need help!
- Inheritance from category for Cython classes: technically feasible. Need help!

- Hom is *not* a functorial construction, the design and user interface needs to be discussed

- Support for multivariate morphims, i.e. morphisms A x B -> C where the specializations A x b -> C are morphisms for a given category and a x B -> C are morphisms for a possibly different category

- Discussion:
- Defining new inline operators, at least within the sage interpreter

**Note:**See TracTickets for help on using tickets.