#14793: Unique representation for homsets
-------------------------------+--------------------------------------------
       Reporter:  nthiery      |         Owner:  nthiery     
           Type:  enhancement  |        Status:  needs_review
       Priority:  major        |     Milestone:  sage-5.12   
      Component:  categories   |    Resolution:              
       Keywords:               |   Work issues:              
Report Upstream:  N/A          |     Reviewers:              
        Authors:  Simon King   |     Merged in:              
   Dependencies:               |      Stopgaps:              
-------------------------------+--------------------------------------------

Comment (by SimonKing):

 Here is an overview of my patch, to facilitate reviewing.

 __sage.categories.homset__

 - A homset is provided with inheritance from `WithEqualityById` (which
 means: Faster comparison), provided that the type of domain and codomain
 shows that domain and codomain and thus the homset are unique parents.
 - It must be tested in some way whether domain and codomain of the to-be-
 created homset belong to the given category. This can fail on parents that
 are not completely initialised during unpickling. If this parent is an
 instance of a Python class, then ''by virtue of the category framework''
 its class tells whether it belongs to the correct category, up to the
 choice of a base ring. I think that in this case we can assume that the
 parent will be fine as soon as its reconstruction/unpickling is complete.
 - Homsets should be pickled using the `Hom` function, hence, with a cache.

 __sage.modular.abvar.abvar__

 - A category should be accepted when creating an endomorphism ring of a
 variety X. Previously, the correct category was read off of X.category().
 However, during unpickling, X.category() might not work, and thus the
 category should be explicit part of the pickle data (and must hence be
 passed to the construction of the endomorphism ring).

 __sage.modular.abvar.homspace__

 - Pass the category parameter to the construction of homspaces (see above)
 - Provide homspaces with an element class
 - Use the element class for constructing its elements.
 - The `_matrix_space` attribute used to be defined during initialisation,
 with information obtained from domain and codomain. Again, during
 unpickling, domain and codomain may be unable to provide such information.
 Hence, I turn `_matrix_space` into a lazy attribute, that will only be
 called ''after'' initialisation, hence, ''after'' finishing unpickling of
 domain and codomain.

 __sage.modules.fg_pid.fgp_module__

 - The modules should better rely on the default implementation of the
 `.Hom()` method. Hence, I renamed `.Hom()` into `._Hom_()`.

 __sage.modules.fg_pid.fgp_morphism__

 - The category should be passed when calling `Homset.__init__`
 - I provided the homsets with an element class

 __sage.modules.matrix_morphism__

 - The constructor of a matrix morphism should accept another matrix
 morphism as an input. This is to make conversion of matrix morphisms
 (between distinct but equal homsets) possible. Aim: Let `TestSuite` pass
 to greater extent.
 - '''TODO''': To make `TestSuite` fully pass, it would be needed that the
 morphisms have a '_mul_` (single underscore) method. Currently, they only
 have a `__mul__` (double underscore) method. This shall be topic of a
 ticket that implements the coercion framework for homsets (I created such
 ticket already, but don't recall the number).

 __sage.schemes.generic.homset__

 - I believe that `SchemeHomset` should not rely on a `UniqueFactory`, but
 should rather rely on the cache of the `Hom` function. However, I did not
 remove the factory. Instead, I overload the `__reduce__` method inherited
 from `Homset` and use the `SchemeHomset` factory for pickling.

 I hope this explanation makes the reviewer happy!

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14793#comment:35>
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/groups/opt_out.


Reply via email to