Skip to content

Categories for the working mathematics programmer #5891

@nthiery

Description

@nthiery

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

Latest version of the patches:

Status and roadmap: http://trac.sagemath.org/sage_trac/wiki/CategoriesRoadMap

Some of the things done in this ticket:

  • Categories:

    • Infrastructure:
      • sage.categories.category (500 lines of code)
      • sage.structure.parent (100 lines of code)
      • class manipulation: (25 lines of code)
    • All the mathematical categories of Axiom and MuPAD (Courtesy of Teresa Gomez Diaz)
      (except *WithSeveralBases which are not needed anymore; see .abstract_category())
      See the category graph: attachment: sage-category-graph.pdf
    • (Infinite/Finite)EnumeratedSets (with example) (Courtesy of Florent Hivert)
    • Semigroups (with example, basic methods, subquotients)
    • FiniteSemigroups (with example, cayley graphs, basic representation theory, ...)
    • ModulesWithBasis (with example, morphisms)
    • HopfAlgebras & friends (with a couple examples)
    • Cleanup:
      • Have unique representation by default (no need to inherit from Category_uniq)
      • Have construction / reduce by default
      • Can systematically use the idiom P in Rings()
    • Lattice structure (join, meet); meet needs cleanup; join and meet
      should be swapped.
  • Reorganization of the Sage library to start using the category framework:

    • Groups:
      • AbelianGroup_class.init was missing a call to Groups.init
      • Support for Group.init(category = ...)
      • AbelianGroups was renamed to CommutativeAdditiveGroups (idem for Semigroups, ...)
        (note: AbelianGroup are about commutative multiplicative groups)
    • NumberFields: bug fix (categories-numberfield_homset-nt.patch):
      Hom(SomeNumberField,SomeVectorSpace) returned a numberfield homset
    • Fixed some import loops
    • Square MatrixSpace in Algebras(...)
    • Added temporary list() methods to:
      • FreeModule_generic
      • MatrixSpace_generic
      • Set_object_enumerated
      • ParentWithAdditiveAbelianGens
      • ParentWithMultiplicativeAbelianGens
        They should eventually be inherited from the EnumeratedSets() category
    • Added sage.sets.finite_enumerated_set
    • Naming conventions and cleanup:
      • parent.product(x,y) parent.product parent.product_on_basis
        (was: multiply, _multiply, multiply_basis, _multiply_basis)

      • parent.summation(x,y) parent.summation # risk of confusion with infinite summation / ...

      • parent.sum ([x,y,z,y])

      • parent.prod([x,y,z,y])

      • parent.coproduct, parent.coproduct_on_basis, parent.coproduct_on_generators

      • parent.antipode, parent.antipode_on_basis, parent.antipode_on_generators

      • cat.example() cat.counter_example()

      • A.one() A.zero() a.is_one() a.is_zero() A(1) A(0) when it makes sense
        A.one_element() A.zero_element() deprecated in the doc; fully deprecated later
        Transitional aliases one = one_element, zero = zero_element

      • Use class.an_instance() whenever meaningful

      • parent.an_element() parent.some_elements(); possibly parent.example() parent.counterexample()

      • all_weakly_super_categories -> all_super_categories(proper=False)

CC: @sagetrac-sage-combinat @roed314 @saliola

Component: categories

Keywords: categories parents

Author: Nicolas M. Thiéry, Teresa Gomez-Diaz

Reviewer: Robert Bradshaw, Craig Citro, Florent Hivert, David Kohel, David Roe, Anne Schilling, William Stein, Javier Vengoroso

Merged: sage-4.3.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/5891

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions