Opened 4 years ago

Last modified 4 years ago

#19346 new defect

Modules with basis: We need to separate ABC from implementation

Reported by: darij Owned by:
Priority: major Milestone: sage-6.10
Component: categories Keywords: combinatorial free module, basis, vectors, modules, sage-combinat
Cc: tscrim, nthiery, sage-combinat Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #18066 Stopgaps:

Description

From what I recall from the discussion at https://groups.google.com/forum/#!topic/sage-combinat-devel/_dtk67RaTFA , the ModulesWithBasis and CombinatorialFreeModule classes are supposed to be an ABC (abstract base class) and a concrete implementation, respectively. However, in practice, the former provides too little abstract interface to be useful, and so a lot of code that uses a module-with-basis as input (explicitly or implicitly) expects to be given a CombinatorialFreeModule instead. Usually this kind of code fails when being passed a ModulesWithBasis instance.

I am posting this here right now because #17096 got positive review, and in that review some issues have been left aside. These issues are essentially a natural second step after cleaning up the ModulesWithBasis-vs-CombinatorialFreeModule mess, and


TODO: Formulate an interface and a contract for

FilteredModulesWithBasis objects. Is a CombinatorialFreeModule with a degree_on_basis method enough? Or is basis still needed? (See the FIXME in src/sage/categories/examples/filtered_modules_with_basis.py.)

TODO: Make sense of A.basis(d) for A a filtered module and d an

integer. This has always been broken.

TODO: doctesting A.basis(d) for A graded. Very easy once above is fixed.

About why I think FilteredModulesWithBasis needs a contract:

Here are the methods on F that are used in the implementations of the methods of FilteredModulesWithBasis when F is cast as a FilteredModulesWithBasis:

ParentMethods:
degree_on_basis
sum_of_terms
monomial
_indices

ElementMethods:
support
leading_support
is_homogeneous
is_zero

I hear the quacking of a CombinatorialFreeModule duck here (except for degree_on_basis which should be explicitly required). Are there any more general categories which offer these methods?

Change History (1)

comment:1 Changed 4 years ago by tscrim

  • Component changed from PLEASE CHANGE to categories
  • Dependencies set to #18066
  • Milestone changed from sage-6.9 to sage-6.10

I think a good part of this is taken care of by #18066, but there will probably be some remaining things related to filtered/graded modules that we will need to address.

Note: See TracTickets for help on using tickets.