sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 481 forks source link

Implement ABCs and categories for Lie algebras and finite dimensional Lie algebras given by structure coefficients #16820

Closed tscrim closed 7 years ago

tscrim commented 10 years ago

Part of #14901. This implements the basic hierarchy of base classes, the categories for Lie algebras, some standard Lie algebras, and finite-dimensional Lie algebras given by structure coefficients.

Component: algebra

Keywords: lie algebras, days64, sd67, days74, days79

Author: Travis Scrimshaw

Branch/Commit: 98c488d

Reviewer: Darij Grinberg, Eric Gourgoulhon

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

tscrim commented 9 years ago

Branch: public/lie_algebras/fd_structure_coeff-16820

tscrim commented 9 years ago

Last 10 new commits:

b35c8d3Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
44a17b9Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
59c0a96Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
48ec188Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
cbfbb87Merge branch 'public/categories/lie_algebras-16819' of trac.sagemath.org:sage into public/categories/lie_algebras-16819
ed93f29Created category for subalgebras of FD Lie algebras with basis.
1a17ff9Merge branch 'public/categories/lie_algebras-16819' into public/lie_algebras/fd_structure_coeff-16820
b302cc1Added free_module abstract method.
96083bfMerge branch 'public/categories/lie_algebras-16819' into public/lie_algebras/fd_structure_coeff-16820
c2a3a98Many changes, fixes, and adding full doctest coverage.
tscrim commented 9 years ago

Commit: c2a3a98

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

c1f3eb3Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
d0ddb8cMerge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
7424e75Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
e5c1703Fixed typos with sl2 construction.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from c2a3a98 to e5c1703

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

45db323Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
036995fCleaning up/Fixing some logic, in particular for FromAssociative.
a135fb3Merge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
b4b89daFixing errors introduced by logic changes.
e9587d7Added a custom lift morphism for Lie alg from assoc.
87bba39Fixing the last issues from the changes.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from e5c1703 to 87bba39

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 87bba39 to ece3cd9

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

65c1f54Removed the LiftMorphism.section map.
becabaaMerge branch 'public/categories/lie_algebras-16819' of trac.sagemath.org:sage into public/categories/lie_algebras-16819
980545eFixed the doc.
8a6950aMerge branch 'public/categories/lie_algebras-16819' of git://trac.sagemath.org/sage into lie1
9b08311a few questions to boot
5a0bc7dAnswering some questions.
144a5a5Small fix for the doc.
198f8a8Added new categories to documentation.
aeb6075Merge branch 'public/categories/lie_algebras-16819' into public/lie_algebras/fd_structure_coeff-16820
ece3cd9Added files to the documentation.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from ece3cd9 to 845e5aa

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

5197c7cMerge branch 'develop' into public/lie_algebras/fd_structure_coeff-16820
845e5aaSome last tweaks and getting full coverage.
tscrim commented 9 years ago

Changed keywords from none to lie algebras, days64

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 845e5aa to 12074e8

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

896028aA y for an x.
2d2a54dMerge branch 'public/categories/lie_algebras-16819' into public/lie_algebras/fd_structure_coeff-16820
6ca7acaFixing some parts of _construct_UEA.
d35b756Adding a default _basis_ordering and _dense_free_module
0e33276Merge branch 'public/categories/lie_algebras-16819' into public/lie_algebras/fd_structure_coeff-16820
e95d67cMore fixes to fin-dim w/ basis category.
c800d6cMerge branch 'public/categories/lie_algebras-16819' into public/lie_algebras/fd_structure_coeff-16820
a491bb0Some more cleanup and fixes.
aabf540Fixing coefficient division.
12074e8Merge branch 'public/categories/lie_algebras-16819' into public/lie_algebras/fd_structure_coeff-16820
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 12074e8 to 9830d63

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

464c131another appearance of free_module
6608a18.module and .to_vector: I still don't get them
106d75dMerge branch 'public/categories/lie_algebras-16819' of git://trac.sagemath.org/sage into lie1
6201720does this make sense?
ddc77b1Merge branch 'public/categories/lie_algebras-16819' of git://trac.sagemath.org/sage into lie1a
b0e36fechanges I forgot to commit a few weeks ago
b412977manual merge with 6.7.beta0
de60849I have no idea what I'm doing
0c28f5freverting parts of previous commit with fire
9830d63Merge branch 'public/lie_algebras/fd_structure_coeff-16820' of git://trac.sagemath.org/sage into lie2
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

6c5fe38minor changes
3d45084fixing Jacobi identity for 3d example (unless Iam wrong? please add tests)
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 9830d63 to 3d45084

darijgr commented 9 years ago
comment:10

Just had a quick look at some of the examples. Please check my last commit and revert if necessary (I cannot test right now since Sage is compiling again).

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d952a7bMerge branch 'public/categories/lie_algebras-16819' into 6.7.b1
dfad36ctrac #16819 wrong inclusion into doc is corrected
eb3b058hopefully fix doc bug
498af17Merge branch 'public/lie_algebras/fd_structure_coeff-16820' of git://trac.sagemath.org/sage into lie2
5e9a839Jacobi identity now tested
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 3d45084 to 5e9a839

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 5e9a839 to 005984d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

005984ddocument the broken multiplication by base ring
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

5bf7cf7documenting LieAlgebraWithStructureCoefficients (mostly scaffolding for myself)
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 005984d to 5bf7cf7

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 5bf7cf7 to 4e8469d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

4e8469dfixing own bugs, and heeding pyflakes
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 4e8469d to 878ab1d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

878ab1dmake generators work correctly for rank0 Heisenberg algebra
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

6f6c529p-Witt algebras, so that we have a characteristic-p example
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 878ab1d to 6f6c529

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 6f6c529 to 052721a

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

052721aI don't know why (and in what sense) three_dimensional covers "all 3-dim Lie algebras", so I weakened that claim. (Maybe it does over fields, but I somehow doubt that it works in general.) Also, corrected a bordercase failure for empty gens.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

4dd721atrac #16820 fixing doc inclusion once again (no .py)
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 052721a to 4dd721a

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 4dd721a to ee3edc4

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

ee3edc4attempt at using from_vector in _element_constructor_; this causes weird errors I have yet to understand
darijgr commented 9 years ago
comment:20

See my last commit. Errors:

**********************************************************************
File "src/sage/algebras/lie_algebras/lie_algebra_element.py", line 179, in sage.algebras.lie_algebras.lie_algebra_element.LieAlgebraElementWrapper.__ne__
Failed example:
    L.zero() == 0
Expected:
    True
Got:
    False
**********************************************************************
File "src/sage/algebras/lie_algebras/lie_algebra_element.py", line 181, in sage.algebras.lie_algebras.lie_algebra_element.LieAlgebraElementWrapper.__ne__
Failed example:
    L.zero() != 0
Expected:
    False
Got:
    True
**********************************************************************

Also, are you sure you meant to keep the dot in sage/algebras/lie_algebras/examples.?

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from ee3edc4 to eb81ce8

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

eb81ce8document brokenness
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from eb81ce8 to 87a227f

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

e37e0c7trac #16820 oops, forgot one dot
87a227fMerge branch 'public/lie_algebras/fd_structure_coeff-16820' with dot removal
tscrim commented 9 years ago
comment:23

It at least covers all 3-dim Lie algebras over char 0 fields (up to isomorphism); I will check when I get home what generality they meant (and put a reference if you think it's necessary).

Also for this change:

+        if hasattr(self, "module") and x in self.module():
+            return self.from_vector(x)

I think you should do

try:
    if x in self.module():
        return self.from_vector(x)
except AttributeError:
    pass

For the FromAssociative.lift...well there's some ambiguity there as to whether we want to lift to the UEA or just some enveloping algebra. I opted to lift just to the defining algebra (which I forgot to change in the docs) as this seemed the most natural. We will also have to deal with subalgebras and a lift there.

For the tested methods, it was originally returning an element from a matrix Lie algebra, but through refactoring this had changed. This can be remedied by changing the 3 to 1, i.e.: L = lie_algebras.three_dimensional_by_rank(QQ, 1).

I'm also not happy with the corner cases being allowed as all properties become vacuous.

Anyways, I'll make changes tomorrow as I will let Sage compile tonight when I get back home.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 87a227f to 8c5361b

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

8c5361bmeanwhile, fix `_acted_upon_` bug
darijgr commented 9 years ago
comment:25

Replying to @tscrim:

It at least covers all 3-dim Lie algebras over char 0 fields (up to isomorphism); I will check when I get home what generality they meant (and put a reference if you think it's necessary).

Ah, please add the reference. That's quite an interesting result.

Also for this change:

+        if hasattr(self, "module") and x in self.module():
+            return self.from_vector(x)

I think you should do

try:
    if x in self.module():
        return self.from_vector(x)
except AttributeError:
    pass

Does this do something different or is it just more pythonic? I am worried about this try-except game as I can't tell whether the AttributeError comes from self.module() or from the self.from_vector(x).

For the FromAssociative.lift...well there's some ambiguity there as to whether we want to lift to the UEA or just some enveloping algebra. I opted to lift just to the defining algebra (which I forgot to change in the docs) as this seemed the most natural. We will also have to deal with subalgebras and a lift there.

I am in favor of renaming it then. The abstract lift lazy_attribute in sage/categories/lie_algebras.py explicitly speaks of the UEA in its doc. A lift that can go anywhere depending on the concrete algebra will be rather useless.

For the tested methods, it was originally returning an element from a matrix Lie algebra, but through refactoring this had changed. This can be remedied by changing the 3 to 1, i.e.: L = lie_algebras.three_dimensional_by_rank(QQ, 1).

Nope, they are still not wrappers.

I'm also not happy with the corner cases being allowed as all properties become vacuous.

The corner cases need to be allowed, and I've already caught at least 2 bugs by inserting tests for them.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

021ed1emore tests
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 8c5361b to 021ed1e

tscrim commented 9 years ago
comment:27

Replying to @darijgr:

Replying to @tscrim:

It at least covers all 3-dim Lie algebras over char 0 fields (up to isomorphism); I will check when I get home what generality they meant (and put a reference if you think it's necessary).

Ah, please add the reference. That's quite an interesting result.

IIRC, it's mostly just doing some linear algebra, going rank by rank, and using the constraint by the Jacobi identity. However I will add it.

Also for this change:

+        if hasattr(self, "module") and x in self.module():
+            return self.from_vector(x)

I think you should do

try:
    if x in self.module():
        return self.from_vector(x)
except AttributeError:
    pass

Does this do something different or is it just more pythonic? I am worried about this try-except game as I can't tell whether the AttributeError comes from self.module() or from the self.from_vector(x).

It is more pythonic (and faster, but not noticably). You are the one who wanted the rule of 3s contract, and because of the category almost every Lie algebra which has a module attribute also has a from_vector. Also I'd say the failure is more graceful this way as if either one is not implemented, then it results in an unable to do the coercion/conversion type error.

For the FromAssociative.lift...well there's some ambiguity there as to whether we want to lift to the UEA or just some enveloping algebra. I opted to lift just to the defining algebra (which I forgot to change in the docs) as this seemed the most natural. We will also have to deal with subalgebras and a lift there.

I am in favor of renaming it then. The abstract lift lazy_attribute in sage/categories/lie_algebras.py explicitly speaks of the UEA in its doc. A lift that can go anywhere depending on the concrete algebra will be rather useless.

Renaming which one? Also it's far from useless to lift to some enveloping algebra as you would want to convert between say, SGA and the Lie algebra.

For the tested methods, it was originally returning an element from a matrix Lie algebra, but through refactoring this had changed. This can be remedied by changing the 3 to 1, i.e.: L = lie_algebras.three_dimensional_by_rank(QQ, 1).

Nope, they are still not wrappers.

Whoops, yes. Do sl(QQ, 2, representation='matrix') or one of the upper triangular matrix Lie algebras.

I'm also not happy with the corner cases being allowed as all properties become vacuous.

The corner cases need to be allowed, and I've already caught at least 2 bugs by inserting tests for them.

No, they don't have to be allowed. In fact, because they are the empty set, they aren't really well-defined to me.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

c183822all doctests pass again :)