Opened 4 years ago
Closed 4 years ago
#26036 closed enhancement (fixed)
Lie algebra morphism defined by values on a Lie generating subset
Reported by:  ghehaka  Owned by:  

Priority:  minor  Milestone:  sage8.4 
Component:  algebra  Keywords:  Lie algebras, morphisms 
Cc:  tscrim  Merged in:  
Authors:  Eero Hakavuori  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  ed5b1e9 (Commits, GitHub, GitLab)  Commit:  ed5b1e9eb2553ea3628a1117101a01cad7446dfc 
Dependencies:  Stopgaps: 
Description
Implementation of a method to define a Lie algebra morphism by giving the images on any Liegenerating subset which need not be the entire basis.
Change History (11)
comment:1 Changed 4 years ago by
 Status changed from new to needs_review
comment:2 Changed 4 years ago by
 Cc tscrim added
 Reviewers set to Travis Scrimshaw
comment:3 Changed 4 years ago by
Thanks for the comment, I am still figuring out the morphism framework, so this is very helpful information. By a hook I take it you mean adding a method named for example lie_algebra_morphism
in sage.categories.lie_algebras.LieAlgebras.FiniteDimensional
? I will add this and change LieAlgebraMorphism_from_generators
to a subclass of LieAlgebraHomomorphism_im_gens
as you suggested.
On another note, I noticed that the test suites skip _test_elements
. Would it be valid to append
if not issubclass(self.__class__, parent._abstract_element_class): self.__class__ = parent.__make_element_class__(self.__class__)
at the end of initialization as in sage.modules.with_basis.morphism.ModuleMorphism.__init__
to make the morphisms proper subclasses of the parent Homspace, or would this cause some problems?
comment:4 Changed 4 years ago by
 Commit changed from 084e213d4252162e4382774d36280add4daa901e to 544750ba8f8807aeaeb51035a0bcfe48308dc068
Branch pushed to git repo; I updated commit sha1. New commits:
544750b  Converted morphism creator into a subclass and added a hook into the finite dimensional Lie algebras category

comment:5 Changed 4 years ago by
I converted the function to a subclass and added the hook into sage.categories.lie_algebras.LieAlgebras.FiniteDimensional.ParentMethods
. However, the test suite for _test_pickling
of the new class fails since the class is creating a parent LieAlgebraHomset
, which does not have unique behavior. I opened a new ticket #26039 about this, since it seems to be an issue unrelated to the new code.
comment:6 Changed 4 years ago by
Thank you for making it into a class. I am planning to change the hook (yes, you interpreted correctly) to just morphism
since we already know it is a Lie algebra. :)
As I mentioned on #26039, you should be using Hom
to create the parent, not directly constructing LieAlgebraHomset
(I know that is a stupid pitfall, but there are [annoying] reasons for it). I will be doing some reviewer modifications now, including fixing that. (Also, the morphism framework probably could use some larger scale refactoring now that we have been adding more types of morphisms, but that is my opinion and a largescale project.)
In regards to your question about setting the __class__
, that might work, but I would be very worried that will cause problems when the homset does not have an explicit Element
set (because it can have many different types of elements).
comment:7 Changed 4 years ago by
 Branch changed from u/ghehaka/lie_morphism_on_gens to public/lie_algebras/morphism_on_generators26036
 Commit changed from 544750ba8f8807aeaeb51035a0bcfe48308dc068 to 4d9b050261bfe024177107a028a4bcff5000352f
Okay, this fixes the pickling issue(s), as well as gives a better interface. Now you can also use the morphism on you Lie algebra elements. If my changes are good, then you can set a positive review.
New commits:
24d0fd7  Renaming and moving lie_algebra_morphism() to morphism(); fixing some other problems.

3c34d3d  Removed trailing whitespace.

bfe5c97  Making the Homset be able to construct these morphisms and other improvements.

4d9b050  Add richcmp to morphisms (rather than use the default).

comment:8 Changed 4 years ago by
 Commit changed from 4d9b050261bfe024177107a028a4bcff5000352f to ed5b1e9eb2553ea3628a1117101a01cad7446dfc
Branch pushed to git repo; I updated commit sha1. New commits:
ed5b1e9  Fixed doctest to refer to new name of function and new punctuation in error message.

comment:9 Changed 4 years ago by
 Status changed from needs_review to positive_review
Looks good to me. I fixed the doctest in finite_dimensional_lie_algebras_with_basis
to use the correct method name and the punctuation change in the error message.
comment:10 Changed 4 years ago by
Whoops, forgot to test that file too. Thank you!
comment:11 Changed 4 years ago by
 Branch changed from public/lie_algebras/morphism_on_generators26036 to ed5b1e9eb2553ea3628a1117101a01cad7446dfc
 Resolution set to fixed
 Status changed from positive_review to closed
Thank you for implementing this! I will have some minor tweaks, but mostly it looks like a good first step. However, we should make this into an actual
Morphism
subclass (so we can define, e.g., compositions and coercions) and we should add a hook to a finitedimensional Lie algebra so that it is exposed to the users. It probably a good idea to subclassLieAlgebraHomomorphism_im_gens
for this. I can do this too if you would want or on a followup.